Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Skip if Other selected with some value

Hello. i have a multiple choice question
Q1
Brand1
Brand2
Brand3
Brand4
Brand5 (Other, specify)

I want skip a particular question if on Q1 is selected Brand5 Other, and user enter a particular text, for example, if on Q5 user enter "Coca Cola" i want to skip a particulat question.
Is it possible?
asked Oct 31, 2013 by catalin22 (410 points)

2 Answers

+2 votes
Yes it is, but not safe...
To take your example you could check if your other field as the value 'Coca Cola' and skip if yes, but it woud work only if 'Coca Cola' is spelled as it is, it would not work if respondant answer 'COCaCOLA', or 'co ca co la' or any variant you can imagine (that are infinite...)
answered Oct 31, 2013 by phronexia Bronze (3,270 points)
Thanks for ypou answer. I know is not safe, but this is what the client want.
I found a possible solution for you to restrict the cases I mentionned in my first answer and make the check a bit safer.

I created a freeformat question called 'CHECK'  just after your Q1 question (on the same page).

In this freeformat I created a variable named CHECK_skip of type 'hidden' and put this code in the HTML part of the freeformat

<input name="CHECK_skip" id="CHECK_skip" type="hidden">
<script type="text/javascript">
<!--
jQuery(document).ready(function(){
    jQuery('#Q1_5_other').change(function(){
        var q1input = jQuery('#Q1_5_other').val().toUpperCase(); // transform in uppercases

        qinputraw = q1input.replace(/ /g,''); // remove all blank spaces
        qinputraw = qinputraw.replace('-',''); // remove hyphens
        qinputraw = qinputraw.replace(',',''); // remove commas
        
        if(qinputraw == 'COCACOLA'){
            jQuery('#CHECK_skip').val(1); 
        }else{
            jQuery('#CHECK_skip').val(0); 
        }
    });
    
});
//-->
</script>


Then, in the skip logic for the freeformat question I have a post-skip to whatever question I want based on condition: 'CHECK_skip=1'

This way if a respondant answers something like 'C  oCA - c,ola  ', the script transform it in 'COCACOLA' removing spaces, hyphens and commas and I compare it to the expected one , if it matches the CHECk_skip hidden field is set to 1 else is set to 0.

Hope this solution can help you
Cheers
Thank you very much. I will try this.
No problem, happy to help.
Don't hesitate to ask me if you have any problem to implement or customize the code I provided
+2 votes
You can use a function called TextExists. The details are as follows ...

TextExists (QuestionName, "TextToLookFor")

Searchers for "TextToLookFor" in the answer of QuestionName. If found, a 1 is returned; if not found, a 0 is returned.

You question name would be the other specify question for the multiple response question you referred to.

Now you should be careful when using skips of this nature because respondents can enter typo's and then your skip will not evaluate as you desire.
answered Oct 31, 2013 by Paul Moon Platinum (61,560 points)
Thank you, i will try using "TextExists"
Other way is to create a custom  javascript using a REGEX to cover some cases (like uppercases/lowercases, spaces in input etc...) and use it as skip condition
...