Millisecond Forums

Save radiobutton responses when branching back to surveypage

https://forums.millisecond.com/Topic31351.aspx

By bjohns47@masonlive.gmu.edu - 4/15/2021

I have been trying to save respondent radiobutton input after branching back to the surveypage when all questions are not completed, but do not know where i am going wrong to save the responses.  The following is the basic script I use, but it branches back and clears the radiobutton responses:

<summarydata>
/ columns = (
expressions.rrank1, expressions.lrank1, expressions.lrank2)
</summarydata>

<expressions>
/rrank1 = radiobuttons.r1.response
/lrank1 = radiobuttons.l1.response
/lrank2 = slider.l2.response
</expressions>

<caption title>
/caption = "DESERT SURVIVAL TASK"
/position = (40,3)
/fontstyle = ("Courier New", 14pt, true)
</caption>


<image computert>
/caption = "Computer Teammate"
/items = ("max1.png")
/imagesize = (50,25)
/position = (70,25)
</image>

<caption linstr00>
/caption = "Using a 7-point scale, please select a rating for the question below and then describe how much time you invested in creating your computer-based teammate."
/position = (10,5.5)
</caption>

r1
<radiobuttons r1>
/caption = "Generally, I trust automated agents."
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,10)
/orientation = horizontal
/required = false
</radiobuttons>


l1
<radiobuttons l1>
/caption = "On a scale of 1(none) to 7(a lot), how much effort did you put into creating your computer-based teammate?"
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,15)
/orientation = horizontal
/required = false
</radiobuttons>

l2
<slider l2>
/caption = "How long(from 1 to 120 minutes) did you take to create your computer-based teammate?"
/labels=[("1", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120")]
/position = (10,22)
/range=(1, 120)
/increment = 5
/orientation = horizontal
/required = false
</slider>


<surveypage last>

/subcaption = "<font color=~"#FF0000~"><%values.errormessagel%></font color>"

/questions = [1 = title, linstr00, computert, r1, l1, l2]

/ ontrialend = [
    values.r1_pre = radiobuttons.r1.response;
    values.l1_pre = radiobuttons.l1.response;
    values.l2_pre = slider.l2.response;
]

/ ontrialend = [if(radiobuttons.r1.response == "" || radiobuttons.l1.response == "" || slider.l2.response == "") {
    values.validlast = false;
            values.errormessagel = "";
            values.errormessagel = concat(values.errormessagel, "One or more itemss have not been completed. Please complete all items.");
    
    } else {
   values.validlast = true;
  };
]
/ branch = [if ( values.validlast == false) surveypage.last]

/ showpagenumbers = false
</surveypage>

<survey DTStest>
/pages = [
    1 = last
]
/ screencapture = false
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ subcaptionfontstyle = ("Arial", 1.5%, false, false, false, false, 5, 1)
/ itemfontstyle = ("Arial", 3%, true, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
/ showpagenumbers = false
/ showquestionnumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (15%, 5%)
/ backbuttonposition = (20%, 98%)
/ nextbuttonposition = (50%, 98%)
/ finishlabel = "Finish - Thank you!"
/ navigationbuttonsize = (20%, 5%)
</survey>

<values>
/ validlast = false
/ r1_pre = 0
/ l1_pre = 0
/ l2_pre = 0
/ errormessagel = ""
</values>

<expt >
/ blocks = [ 1 = lastlist]
</expt>

<block lastlist>
/ trials = [1=last]
</block>

<defaults>
/ fontstyle = ("Courier New", 12pt)
/ screencolor = (255, 255, 255)
</defaults>
By Dave - 4/15/2021

I have been trying to save respondent radiobutton input after branching back to the surveypage when all questions are not completed, but do not know where i am going wrong to save the responses.  The following is the basic script I use, but it branches back and clears the radiobutton responses:

<summarydata>
/ columns = (
expressions.rrank1, expressions.lrank1, expressions.lrank2)
</summarydata>

<expressions>
/rrank1 = radiobuttons.r1.response
/lrank1 = radiobuttons.l1.response
/lrank2 = slider.l2.response
</expressions>

<caption title>
/caption = "DESERT SURVIVAL TASK"
/position = (40,3)
/fontstyle = ("Courier New", 14pt, true)
</caption>


<image computert>
/caption = "Computer Teammate"
/items = ("max1.png")
/imagesize = (50,25)
/position = (70,25)
</image>

<caption linstr00>
/caption = "Using a 7-point scale, please select a rating for the question below and then describe how much time you invested in creating your computer-based teammate."
/position = (10,5.5)
</caption>

r1
<radiobuttons r1>
/caption = "Generally, I trust automated agents."
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,10)
/orientation = horizontal
/required = false
</radiobuttons>


l1
<radiobuttons l1>
/caption = "On a scale of 1(none) to 7(a lot), how much effort did you put into creating your computer-based teammate?"
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,15)
/orientation = horizontal
/required = false
</radiobuttons>

l2
<slider l2>
/caption = "How long(from 1 to 120 minutes) did you take to create your computer-based teammate?"
/labels=[("1", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120")]
/position = (10,22)
/range=(1, 120)
/increment = 5
/orientation = horizontal
/required = false
</slider>


<surveypage last>

/subcaption = "<font color=~"#FF0000~"><%values.errormessagel%></font color>"

/questions = [1 = title, linstr00, computert, r1, l1, l2]

/ ontrialend = [
    values.r1_pre = radiobuttons.r1.response;
    values.l1_pre = radiobuttons.l1.response;
    values.l2_pre = slider.l2.response;
]

/ ontrialend = [if(radiobuttons.r1.response == "" || radiobuttons.l1.response == "" || slider.l2.response == "") {
    values.validlast = false;
            values.errormessagel = "";
            values.errormessagel = concat(values.errormessagel, "One or more itemss have not been completed. Please complete all items.");
    
    } else {
   values.validlast = true;
  };
]
/ branch = [if ( values.validlast == false) surveypage.last]

/ showpagenumbers = false
</surveypage>

<survey DTStest>
/pages = [
    1 = last
]
/ screencapture = false
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ subcaptionfontstyle = ("Arial", 1.5%, false, false, false, false, 5, 1)
/ itemfontstyle = ("Arial", 3%, true, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1)
/ txcolor = (0, 0, 0)
/ showpagenumbers = false
/ showquestionnumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (15%, 5%)
/ backbuttonposition = (20%, 98%)
/ nextbuttonposition = (50%, 98%)
/ finishlabel = "Finish - Thank you!"
/ navigationbuttonsize = (20%, 5%)
</survey>

<values>
/ validlast = false
/ r1_pre = 0
/ l1_pre = 0
/ l2_pre = 0
/ errormessagel = ""
</values>

<expt >
/ blocks = [ 1 = lastlist]
</expt>

<block lastlist>
/ trials = [1=last]
</block>

<defaults>
/ fontstyle = ("Courier New", 12pt)
/ screencolor = (255, 255, 255)
</defaults>

r1
<radiobuttons r1>
/caption = "Generally, I trust automated agents."
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,10)
/orientation = horizontal
/required = false
/ defaultresponse = values.r1_pre
</radiobuttons>


l1
<radiobuttons l1>
/caption = "On a scale of 1(none) to 7(a lot), how much effort did you put into creating your computer-based teammate?"
/options = ("1", "2", "3", "4", "5", "6", "7")
/position = (10,15)
/orientation = horizontal
/required = false
/ defaultresponse = values.l1_pre
</radiobuttons>

l2
<slider l2>
/caption = "How long(from 1 to 120 minutes) did you take to create your computer-based teammate?"
/labels=("1", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120")
/position = (10,22)
/range=(1, 120)
/increment = 5
/orientation = horizontal
/required = false
/ defaultresponse = values.l2_pre
</slider>

is what's missing.
By bjohns47@masonlive.gmu.edu - 4/15/2021

Dave,

Thank you again. The slider still does not initiate a branch back to the surveypage if the slider is not touched. A '1' is always recorded as the response in the summary data. Is there something wrong in my logic to create a branch if the slider is not touched?
By bjohns47@masonlive.gmu.edu - 4/15/2021

Dave,

I have determined a method that ensures that the slider is greater than 0, and this ensures that the slider causes a brank back to the survey page if the slider is not mover by making the following changes:

<slider l2>
/caption = "How long(from 1 to 120 minutes) did you take to create your computer-based teammate?"
/labels=[("0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "110", "120")]
/position = (10,17)
/range=(0, 120)
/increment = 5
/orientation = horizontal
/required = false
/defaultresponse = values.l2_pre
</slider>


/ ontrialend = [if(radiobuttons.l1.response == "" || slider.l2.response == 0) {
    values.validlast = false;
            values.errormessagel = "";
            values.errormessagel = concat(values.errormessagel, "One or more itemss have not been completed. Please complete all items.");
    
    } else {
   values.validlast = true;
  };
]:
By Dave - 4/15/2021

Dave,

Thank you again. The slider still does not initiate a branch back to the surveypage if the slider is not touched. A '1' is always recorded as the response in the summary data. Is there something wrong in my logic to create a branch if the slider is not touched?

> The slider still does not initiate a branch back to the surveypage if the slider is not touched. A '1' is always recorded as the response in the summary data.

That is the intended behavior if a slider is set to /required = false.