Have an idea?

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

Ranking question with exclusive option

We have a ranking question in which with have a "Don't Know" option that we want to be exclusive (aka, if you choose this option, you can't rank anything else). I saw a question similar to this on the forum, but the only answer to it just mentioned using javascript. I'm familiar with javascript and have used it but I'm not sure how to approach this type of question using it. Can someone point me in the right direction?
related to an answer for: Ranking Question with Exclusive
asked May 28, 2013 by anonymous
retagged May 28, 2013 by Walter Williams
I have done this many times. You can create simple grid question and use some keyup function. You need to use custom JavaScript to generate required response error. Let me know if you are looking for hard code. I can send you in your email id.
An example of the code that would be needed would be greatly appreciated. Also, I'm not sure what you mean by "keyup function"?
Give me your email id, will send you file
Sent . Let me know in case of any more help required.
I copied the code provided by you but it doesn't seem to work. Can you please send me updated code(if any) to tarunsharma1611@gmail.com.


1 Answer

+3 votes
So in case you have question Q1, just add one free format question under this quesiton (let's say Q1DN), it should be check box type so variable should be Q1DN_r_1. Now put below script in it's footer.

<script type="text/javascript">
var obj1 = SSI_GetFormObject("Q1_r1_c1");
var obj2 = SSI_GetFormObject("Q1_r2_c1");
var obj3 = SSI_GetFormObject("Q1_r3_c1");
var obj4 = SSI_GetFormObject("Q1_r4_c1");
var obj5 = SSI_GetFormObject("Q1_r5_c1");

obj1.addEvent("keyup", hello);
obj2.addEvent("keyup", hello);
obj3.addEvent("keyup", hello);
obj4.addEvent("keyup", hello);
obj5.addEvent("keyup", hello);

function SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck)  

    if(InputObj.name == "Q1DN_r_1" && blnCheck == true)  



and paste this function in Advance->HTML<head>tag.

<script type="text/javascript">
function hello()

    var FirstStateChecked1 = SSI_GetValue("Q1DN_r_1");
            var Num1Obj = SSI_GetFormObject("Q1DN_r_1");

Also make all option optional here and use custom javascript verification. Like this..

if((document.mainform.Q1_r1_c1.value=="" && document.mainform.Q1_r2_c1.value=="" && document.mainform.Q1_r3_c1.value=="" && document.mainform.Q1_r4_c1.value=="" && document.mainform.Q1_r5_c1.value=="") && document.mainform.Q1DN_r_1.checked==false)
    strErrorMessage="A response is required.";

Let me know if still need solution.
answered Jun 14, 2013 by Rajesh Rana Gold (23,430 points)