Home › Forums › Quform WordPress › Use Jquery to set value of multiple radios based on dropdown
- This topic has 4 replies, 2 voices, and was last updated 7 years, 10 months ago by jerkski.
- AuthorPosts
- June 16, 2016 at 9:23 pm #19369jerkskiParticipant
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?
June 17, 2016 at 6:56 pm #19384AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 20, 2016 at 3:53 pm #19391jerkskiParticipantAlly, 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.
June 20, 2016 at 6:06 pm #19396AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 20, 2016 at 7:09 pm #19397jerkskiParticipantPerfect! You know your stuff! Thank you Ally. You may mark this as solved 🙂
- AuthorPosts
- You must be logged in to reply to this topic.