Title: Hidden required fields
Last modified: August 30, 2016

---

# Hidden required fields

 *  [Blaz8](https://wordpress.org/support/users/blaz8/)
 * (@blaz8)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/hidden-required-fields/)
 * Ive created a simple booking form and at the end of the form the user has the
   option to add an additional person. If they select yes in the dropdown menu a
   hidden form will appear, all the fields are required. The problem im having is
   if someone doesnt need an additional person adding and just fills in the standard
   form, the form still flags the required fields for the the hidden form.
 * The easy fix is to add a value to those fields, but that means a user has to 
   delete the text to enter their own. Has anyone come across a fix for this?
 * Thanks
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [ddgiants](https://wordpress.org/support/users/ddgiants/)
 * (@ddgiants)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/hidden-required-fields/#post-6400346)
 * I’ve had this exact issue. I created a .js file in my theme subdirectory. I didn’t
   want this script called on every page. This script has my jquery form logic. 
   If a user checks a box it shows the additional form fields AND makes them required
   using $(id_if_input).prop(‘required’,true);
 *  Thread Starter [Blaz8](https://wordpress.org/support/users/blaz8/)
 * (@blaz8)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/hidden-required-fields/#post-6400379)
 * Still cant seem to get it working … heres my code, where am i going wrong?
 *     ```
       //Hide the field initially
               $("#delegate1").hide();
   
       $('#additional').change(function() {
                       if ($('#additional').val() == "Yes") {
                               $('#delegate1').show();
       		        $("#inputiid").prop('required',true);
                       }
                       else {
                               $('#delegate1').hide();
                       }
               });
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hidden required fields’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Blaz8](https://wordpress.org/support/users/blaz8/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/hidden-required-fields/#post-6400379)
 * Status: not resolved