• Resolved Damn!

    (@greedymind)


    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: https://prntscr.com/hf05k5
    Form 2 displaying both “kgs” and “lbs” fields: https://prntscr.com/hf05st

    Thanks,

    • This topic was modified 7 years, 4 months ago by Damn!.
    • This topic was modified 7 years, 4 months ago by Damn!.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    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

    Best regards.

    Thread Starter Damn!

    (@greedymind)

    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 7 years, 4 months ago by Damn!.
    Plugin Author codepeople

    (@codepeople)

    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!

    (@greedymind)

    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

    • This reply was modified 7 years, 4 months ago by Damn!.
    Plugin Author codepeople

    (@codepeople)

    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!

    (@greedymind)

    Hello,

    That piece of code did fix the issue. Thanks a lot for the help. You are the best.

    • This reply was modified 7 years, 4 months ago by Damn!.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fields don’t hide by default’ is closed to new replies.