Title: Fields don&#8217;t hide by default
Last modified: November 25, 2017

---

# Fields don’t hide by default

 *  Resolved [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/)
 * Hello,
 * I recently noticed an issue with the form. So the scenario is, the fields in 
   form 2 (Goal calculator) change to “kgs” or “lbs” depending on the user’s selection
   in from 1 (TDEE calculator). The field (Unit system) in form 1 is by default 
   set to “Metric” which should only show “Kgs” fields in form 2 but during initial
   page load the form displays both “kgs” and “lbs” fields and its not until you
   change the value to “Imperial” the changes in form 2 takes place.
 * The problem is, Unless the user changes the value of the field “unit system” 
   from “Metric” to “Imperial”, the form 2 will be displaying 2 extra fields. This
   will confuse the user. How do I fix this?
 * I will attach some screenshots below:
 * The value during inital page load: [http://prntscr.com/hf05k5](http://prntscr.com/hf05k5)
   
   Form 2 displaying both “kgs” and “lbs” fields: [http://prntscr.com/hf05st](http://prntscr.com/hf05st)
 * Thanks,
    -  This topic was modified 8 years, 6 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
    -  This topic was modified 8 years, 6 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffields-dont-hide-by-default%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720327)
 * Hello,
 * It is not an issue, the dependencies affect only the fields in the same form,
   so, I assume you’re emulating the dependencies between fields in different forms.
   If it is the case, you simply should trigger programmatically the onchange event
   in the element that hides the fields in the second form, when the second form
   is loaded.
 * If you need a custom coding service do not hesitate in contact me through my 
   private website:
 * [https://cff.dwbooster.com/customization](https://cff.dwbooster.com/customization)
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720351)
 * But It was already done, please see the below code:
 *     ```
       <script>
       jQuery(document).on('change', '.my-unit-dropdown select', function(){
       if(jQuery(this).val() == 'Metric')
       {
       jQuery('.my-auxiliary-kg-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       else
       {
       jQuery('.my-auxiliary-lbs-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       });
       jQuery(window).on('load', function(){
       jQuery('.my-unit-dropdown select').change();
       });
       </script>
       ```
   
    -  This reply was modified 8 years, 6 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720445)
 * Hello,
 * Please, set a timeout to be sure the form has been rendered before calling the
   onchange event, for example:
 *     ```
       jQuery(window).on('load', function(){
       setTimeout(function(){jQuery('.my-unit-dropdown select').change();}, 1000);
       });
       ```
   
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720455)
 * Hello,
 * Did that and there seems to be no change in the form. I can still see all the
   4 fields.
 * Please check this page: [damnripped.com/test](http://damnripped.com/test)
    -  This reply was modified 8 years, 6 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720468)
 * Hello,
 * In the second form insert a “HTML Content” field with the piece of code below
   as its content:
 *     ```
       <script>
       fbuilderjQuery(document).one('showHideDepEvent', function(){
       setTimeout(function(){jQuery('.my-unit-dropdown select').change();}, 1000);
       });
       </script>
       ```
   
 * And if the issue persists would be required you request a custom coding service
   for checking your forms code and implement this behavior. Take into account that
   dependencies between forms is specific to your project and not a feature in the
   plugin.
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720772)
 * Hello,
 * That piece of code did fix the issue. Thanks a lot for the help. You are the 
   best.
    -  This reply was modified 8 years, 6 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).

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

The topic ‘Fields don’t hide by default’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Damn!](https://wordpress.org/support/users/greedymind/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/fields-dont-hide-by-default/#post-9720772)
 * Status: resolved