Home › Forums › Quform WordPress › Creating a dynamic Conditional on multiple selects
- This topic has 4 replies, 2 voices, and was last updated 1 year, 4 months ago by
Ally.
- AuthorPosts
- October 22, 2021 at 4:11 pm #33549
GOMLP
ParticipantHi Ally,
Happy Friday!
I have another situation that I’m sure you have an answer. I have included some screen shots of Page4 of my form.
On the Form there are three (3) select fields, the first select field (Industry Category) has it’s values set through the element attribute panel which then sets the value of the second select field (Substrate Category) dynamically, combined together select 1 (Industry Category) value and select 2 (Substrate Category) value sets the value for the third select field (Substrate) dynamically.
What I want to do is create a dynamic value written to a hidden field that can be used as a conditional show/hide for the description below on the form when the customer sets all three values of the three select fields.
Below is a list of the fields I have and their Unique ID:
Industry Category = 14_197
Substrate Category = 14_196
Substrate = 14_217
Substrate Code (hidden) = 14_360This is the code I tried and either my brain is fried or I have the basic concept down just not seeing through my own eyes what I am doing wrong.
jQuery(function ($) {
var $select1 = $(‘.quform-field-14_197’),
$select2 = $(‘.quform-field-14_196’),
$select3 = $(‘.quform-field-14_217’),
$select4 = $(‘.quform-field-14_360’);var data = {
‘WineSpirits:Paper:16328’: [
{ text: ‘Natural Label’, value: ‘16328’ }
],‘WineSpirits:Paper:16328’: [
{ text: ‘Natural Label’, value: ‘16328’ }
};
$select1.add($select2).add($select3).on(‘change’, function () {
var value = $select1.val() + ‘:’ $select2.val() + ‘:’ + $select3.val(),
options = [new Option(‘Please select’, ”)];if (data[value]) {
for(var i = 0; i < data[value].length; i++) {
options.push(new Option(data[value][i].text, data[value][i].value));
}
}$select4.html(options).prop(‘selectedIndex’, 0);
}).change();
});PS. I’m probably your most challenging client and I’m sorry 🙁
Attachments:
You must be logged in to view attached files.October 25, 2021 at 10:26 am #33560Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 28, 2021 at 9:37 pm #33573GOMLP
ParticipantThank you once again! I will be posting another question as I’ve been stuck on it for two days… You are helping with my headache from you know where….lol
October 28, 2021 at 10:20 pm #33578GOMLP
ParticipantThe logical conditions are not working on this code… Any other ideas?
October 29, 2021 at 10:38 am #33584Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.