dongqiao9015 2016-02-23 15:25
浏览 19
已采纳

用php中的可选字段替换所需的类

I am new to PHP and I purchased a theme that I need to customize the registration form. The fields are all required by default and the only way is to customize. How do I replace the "required" class with optional? Lastly, if i can also change a URL input to a file upload (csv feed and logo). Thank in advance guys

 <form class="register-store">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_name"><?php esc_attr_e( 'Store Name', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_name" id="store_name">
                                        <p class="field-description"><?php _e( 'Input name of your store', 'compare' ) ?></p>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_url"><?php esc_attr_e( 'Store URL', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_url" id="store_url">
                                        <p class="field-description"><?php _e( 'Input link to your store', 'compare' ) ?></p>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_contact_name"><?php esc_attr_e( 'Your Name', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_contact_name" id="store_contact_name">
                                        <p class="field-description"><?php _e( 'Input your full name', 'compare' ) ?></p>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_contact_phone"><?php esc_attr_e( 'Your Phone', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_contact_phone" id="store_contact_phone">
                                        <p class="field-description"><?php _e( 'Input your phone with internation prefix', 'compare' ) ?></p>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_contact_email"><?php esc_attr_e( 'Your Email', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_contact_email" id="store_contact_email">
                                        <p class="field-description"><?php _e( 'Input your mail for contact', 'compare' ) ?></p>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_package"><?php esc_attr_e( 'Chose your package', 'compare' ) ?> <span class="required">*</span>
                                        <?php
                                        $all_packages_link = compare_get_permalink_by_tpl( 'page-tpl_packages' );
                                        if( $all_packages_link !== 'javascript:;' ):
                                        ?>
                                        <a href="<?php echo esc_url( $all_packages_link ) ?>" class="pull-right"> <?php _e( 'Check list of available packages', 'compare' ) ?></a></label>
                                        <?php endif; ?>
                                        <select name="store_package" id="store_package" class="form-control">
                                            <option value=""><?php _e( 'Select Package', 'compare' ) ?></option>
                                            <?php echo compare_list_packages(); ?>
                                        </select>
                                        <p class="field-description"><?php _e( 'Select package for your store', 'compare' ) ?></p>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_xml_feed"><?php esc_attr_e( 'Store Feed URL', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_xml_feed" id="store_xml_feed">
                                        <p class="field-description"><?php _e( 'Input link to your XML / CSV products feed', 'compare' ) ?></p>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="input-group">
                                        <label for="store_logo"><?php esc_attr_e( 'Store Logo URL', 'compare' ) ?> <span class="required">*</span></label>
                                        <input type="text" class="form-control" name="store_logo" id="store_logo">
                                        <p class="field-description"><?php _e( 'Input link to your store logo', 'compare' ) ?></p>
                                    </div>
  • 写回答

2条回答 默认 最新

  • dpd46554 2016-02-23 15:34
    关注

    Depending on how the template you purchased is designed, you should just be able to remove the <span class="required">*</span>. At that point, the input field should be in it's default state, which will allow a user to input information (or not). Also, to accomplish a file upload, change the <input type=""> to 'file'

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效