If you are using the Cascading Dropdown question and one of your menus has only one option you might want to have the survey automatically select it for your respondents. While there isn't a built-in way to achieve this; we have a super-simple, copy-and-paste script that will do this for you.
Check it out in an example survey!
OR
Add a survey with this script to your account!
Setup
- To set this up add a JavaScript Action to the same page as your Cascading Dropdown question.
- Copy and paste the below script. Save your JavaScript Action and test it out!
$(function() {
$('.sg-question-cascading select').change(function() {
var el = $(this);
if (el.children().length == 2 && el[0].selectedIndex != 1) {
el[0].selectedIndex = 1;
el.trigger('change');
}
});
});
Note: If you have multiple Cascading Dropdown questions in your survey with a single option in one of the dropdown menus, you will need to add this script to each page where the a Cascading Dropdown is present.
Scripting and Other Custom Solutions
We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.
If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for SurveyGizmo features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!
Admin
— Bri Hillmer on 04/24/2017
@Loren: I'm sorry this script is not working for you. We do not have the scripting resources to modify this script as you desire. Fortunately, this is the kind of customization that our Programming Services team commonly does for a fee. You can learn more about these services here:
https://www.surveygizmo.com/programming-services/
Bri Hillmer
Documentation Coordinator
SurveyGizmo Customer Experience Team
— Publix on 04/24/2017
If a participant starts down a path using options that have more that one level, but then goes back and changes their first response to an answer with only 1 follow up choice, the script will not work. Using your example survey, if a participant first clicks "option 1" under the "first selection" and then clicks option 3 as under "second selection", but then realizes that they made a mistake and changes their first selection to "option 2," the script will not activate. Is there any way around this?