Use Jquery to set value of multiple radios based on dropdown

Home Forums Quform WordPress Use Jquery to set value of multiple radios based on dropdown

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19369
    jerkski
    Participant

    Hi, I am trying to set the values of many multiple choice fields with one dropdown to ease the selection process for users when all multiple choice are to be the same value. A perfect example is the dropdown values are either All Pos or All Neg. If I choose All Pos, I want to use jquery to set the values of all multiple choice to Pos. Same for All Neg.

    I added this script as a starting point for setting just one multiple choice field, but cannot get it to trigger when I make a selection in the dropdown. Ultimately I would like to add many multiple choice fields to this.

    <script>
        jQuery(document).ready(function ($) {
            $('.iphorm_5_151').change(function () {
                var value = $(this).val();
                var $amp = $(.'iphorm_5_28');
    
                if (value == 'Pos.') {
    		            $amp.val('Pos.').change();
                    } 
    	          else if (value == 'Neg.') {
                    $amp.val('Neg.').change();
                    }
                  }
    $.uniform.update();
    }).change();
    );
    </script>

    Thoughts?

    #19384
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #19391
    jerkski
    Participant

    Ally, Thank you!! Works great! The second example you posted is the one i needed. Is there a quick way to allow changing the radio selection for many quform fields at the same time with the above example? Or do I need to create variables and functions for each radio I need to control?

    • This reply was modified 7 years, 10 months ago by jerkski.
    #19396
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #19397
    jerkski
    Participant

    Perfect! You know your stuff! Thank you Ally. You may mark this as solved 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy