Home › Forums › Quform WordPress › Conditional Radio Button Options in JQUERY
- This topic has 3 replies, 2 voices, and was last updated 6 years, 4 months ago by
katw.
- AuthorPosts
- November 18, 2018 at 11:43 pm #27764
katw
ParticipantHi Ally,
I want to dynamically generate a radio button group.
The options within the generated group will be dictated by a previous answer given by the user through a parent radio group.
This is a JQUERY/Javascript project as the form isn’t submitted so Hooks are out.
Looking at the structure of your code for
div.quform-input-radio
and the.quform-options
I see an auto-generated form element ID (id="quform_2_81_18a0cd_1"
).Is this a magic value/id? OR can I use any unique ID when I auto-build the radio input group options?
Code for one radio option:
<div class="quform-option"> <input type="radio" name="quform_2_81" <strong>id="quform_2_81_18a0cd_1"</strong> class="quform-field quform-field-radio quform-field-2_81 quform-field-2_81_1" value="DBVALUE"> <label for="quform_2_81_18a0cd_1" class="quform-option-label quform-option-label-2_81_1"><span class="quform-option-icon-selected"><i class="fa fa-desktop"></i></span><span class="quform-option-text">USERLABEL</span> </label> </div>
The above block will be auto-built as some radio button groups have more/less options which means I can’t just change field label or value.
Thanks for advice.
November 20, 2018 at 2:10 am #27776katw
ParticipantHi Ally,
Just following up to see if you have had a chance to read above.
I don’t need you to write anything (my job); what I do need is confirmation on your algorithm for generating radio button option IDENTIFIERS.
If I create my own unique identifier and keep your prefix “quform_2_81_” and trailing suffix “_#” will everything BIND okay?
So my thinking is:
I populate the “######” part of the
<input id="quform_2_81_######_1" ....>
with my own 6 character unique alphanumeric code for EACH auto-generated RADIO GROUP/SET. And I should be okay.Yes?
November 20, 2018 at 1:36 pm #27781Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 27, 2018 at 11:08 pm #27865katw
ParticipantThanks for confirming. Close ticket
- AuthorPosts
- You must be logged in to reply to this topic.