Hi there,
I hope this is the right place to ask this question and I would be grateful if someone could shed some light on it.
In my form I have:
Dropdown #1:
Option 1
Option 2
Option 3
Dropdown #2:
Option 1
Option 2
Option 3
If a user selects Option 1 from Dropdown #1 and Option 3 from Dropdown #2 then another field should become visible. Obviously, any other combination of the answers will hide this field.
I know how to show/hide fields based on a dropdown selection but I don’t know how I can put an “AND” between to separate selections.
Thanks in advance for any help.
I hope this is the right place to ask this question and I would be grateful if someone could shed some light on it.
In my form I have:
Dropdown #1:
Option 1
Option 2
Option 3
Dropdown #2:
Option 1
Option 2
Option 3
If a user selects Option 1 from Dropdown #1 and Option 3 from Dropdown #2 then another field should become visible. Obviously, any other combination of the answers will hide this field.
I know how to show/hide fields based on a dropdown selection but I don’t know how I can put an “AND” between to separate selections.
Thanks in advance for any help.
You might have to do it with jQuery. On change for dropdown 2, select "function", and in the target field (the one on the right, so not the 'value' field) put the name of your function.
In a custom JS block, put something along the lines of
Alternatively, you can use a Segment or Container area, and onchange for the dropdown reload the segment/container area. Inside the area you would have a Switcher Area with the necessary fields under the necessary condition blocks.
In a custom JS block, put something along the lines of
function myFunction(elem) {If you need to do more complicated things like removing validation then you'll have to look at form validation in the Semantic UI docs.
var drop1 = jQuery('select [name="dropdown1"]').dropdown('get value');
var drop2 = jQuery('select [name="dropdown2"]').dropdown('get value');
if(whatever your logic is) {
jQuery('input[name="fieldname"]').removeClass("hidden"); // Will SHOW the field
}
else {
jQuery('input[name="fieldname"]').addClass("hidden"); // Will HIDE the field
}
}
Alternatively, you can use a Segment or Container area, and onchange for the dropdown reload the segment/container area. Inside the area you would have a Switcher Area with the necessary fields under the necessary condition blocks.
Thanks healyhatman, that works a treat.
At this stage I just needed to Show/Hide a field and your suggestion and the snippet worked perfectly.
Thanks for your help.
At this stage I just needed to Show/Hide a field and your suggestion and the snippet worked perfectly.
Thanks for your help.
No problem.
If you ever need anything more complex that CF doesn't provide, I sell custom plugins for CF and CC on my site at skyspider.com.au/store
If you ever need anything more complex that CF doesn't provide, I sell custom plugins for CF and CC on my site at skyspider.com.au/store
This topic is locked and no more replies can be posted.