• Resolved Silent Ace

    (@silent-ace)


    Hello,

    First i would like to congratulate on this awesome plugin it’s really helpful and saves a lot of time.

    I do however have a question for the dropdown conditions. I have one main dropdown with options, and multiple second dropdowns that when selected display an image. The structure is something like this

    Main dropdown:
    – Select
    – Acryl
    – Tint
    If the first option from the main dropdown is chosen
    – Select
    – Blue
    – Red
    – Orange
    If the second option is chosen the previous dropdown is hidden and i have the second dropdown options
    – Select
    – Black
    – Metalic
    – Grey
    After which whatever option is chosen an image is displayed.

    The problem that i have is that when i make changes to the first dropdown and then the second and then chose again the images stack on top of each other. This is because both dropdown conditions are fulfilled to display the image. Is there a way to reset the second dropdown menu to the default Select value when the value of the main dropdown changes?

    Thanks

    https://www.ads-software.com/plugins/calculated-fields-form/

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    There is a simple way to get the behavior you need. Add a class name to the first DropDown, for example: main

    and add another class name to the rest of the DropDown fields, for example: sub

    Finally, insert a “HTML Content” field in the form with the following content:

    <script>
    jQuery(document).on('change', '.main select', function(){
    jQuery('.sub option:first').prop('selected', true);
    });
    </script>

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Dropdowns restart to default value’ is closed to new replies.