Creating a dynamic Conditional on multiple selects

Home Forums Quform WordPress Creating a dynamic Conditional on multiple selects

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

    Hi 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_360

    This 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.
    #33560
    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.

    #33573
    GOMLP
    Participant

    Thank 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

    #33578
    GOMLP
    Participant

    The logical conditions are not working on this code… Any other ideas?

    #33584
    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.

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