-1

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>
Avichai
  • 1
  • 3
  • Well, based on what you've posted, it probably has something to do with the `` (have you tried replacing that with "optional"?) but this isn't enough information to know for sure. What do you mean "purchased a theme"? Theme for what? You should [edit] to add that information and tag if applicable. – user812786 Feb 23 '16 at 15:33
  • All fields have changed but I still get "all fields required" when I test it – Avichai Feb 23 '16 at 16:25

2 Answers2

0

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'

dannyk
  • 259
  • 1
  • 6
  • 21
  • Wow, thanks a tonne. I have been struggling with this for days. and I just joined stacks today. :-) – Avichai Feb 23 '16 at 15:45
  • @Avichai happy to help and welcome to the community! – dannyk Feb 23 '16 at 18:30
  • the field titles have changed but i still get "all fields required" error when I test it – Avichai Feb 24 '16 at 07:18
  • @Avichai I would recommend reaching out to the provider you purchased your template from. In the past, when I've worked with templates, the selling-party usually has a support team that can answer your questions regarding the inner workings of their template. I would highly suggest contacting them or checking their main website for any relevant documentation that might be available and outlines how to properly use the template – dannyk Feb 24 '16 at 14:58
0

When you see <span class="required">*</span> it only affects the render of the form, it does not contain the data control. Data control is made server-side, which means you have to dig into the PHP code to remove the check on the fields you want to set optionals. Tell us what CMS you use, WordPress maybe ? I'll update my answer accordingly. Also share with us the name of the theme you bought.

JesusTheHun
  • 1,217
  • 1
  • 10
  • 19
  • Hi JesusTheHun, am using WP. The theme is called Compare by power themes. The documentation isn't too good. – Avichai Feb 23 '16 at 15:57