surveypage if statement branching not working if there's a new line in the question answer


surveypage if statement branching not working if there's a new line in...
Author
Message
nrouhani
nrouhani
Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)
Group: Forum Members
Posts: 83, Visits: 261
hello, 

i've created a surveypage where you have to click on the right answer to move to the next page, but if i insert a new line into the correct answer (as well as to the if statement), it no longer registers as correct. do you know what i could do to make this work while including a new line within the question answer? 

for example: 
<surveypage questions>
/ caption = "Before starting the experiment, please answer the following questions and click submit. Once you've answered all questions correctly, the task will automatically load. If you do not answer correctly, you will see the instructions again."
/ fontstyle = ("Arial", 30)
/ txcolor = white
/ showquestionnumbers = false
/ questions = [1=question1; 2=question2; 3=question3]
/ branch = [
if (radiobuttons.question1.response=="c) the value of each image is determined by the average value of images within that room,~n and this average can change") surveypage.success else surveypage.fail
]
</surveypage>

<radiobuttons question1>
/ caption = "Which statement is true about the values of the images in each room?"
/ options = ("a) the value of each image is dependent on its quality", "b) the value of each image is determined by the average value of images within that room, and this average
doesn't change", "c) the value of each image is determined by the average value of images within that room,~n and this average can change")
</radiobuttons>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
nrouhani - Wednesday, December 6, 2017
hello, 

i've created a surveypage where you have to click on the right answer to move to the next page, but if i insert a new line into the correct answer (as well as to the if statement), it no longer registers as correct. do you know what i could do to make this work while including a new line within the question answer? 

for example: 
<surveypage questions>
/ caption = "Before starting the experiment, please answer the following questions and click submit. Once you've answered all questions correctly, the task will automatically load. If you do not answer correctly, you will see the instructions again."
/ fontstyle = ("Arial", 30)
/ txcolor = white
/ showquestionnumbers = false
/ questions = [1=question1; 2=question2; 3=question3]
/ branch = [
if (radiobuttons.question1.response=="c) the value of each image is determined by the average value of images within that room,~n and this average can change") surveypage.success else surveypage.fail
]
</surveypage>

<radiobuttons question1>
/ caption = "Which statement is true about the values of the images in each room?"
/ options = ("a) the value of each image is dependent on its quality", "b) the value of each image is determined by the average value of images within that room, and this average
doesn't change", "c) the value of each image is determined by the average value of images within that room,~n and this average can change")
</radiobuttons>


The best way is to define /optionvalues in your <radiobuttons> that do not contain the new line / line break, and base the /branch on that:

<radiobuttons question1>
/ caption = "Which statement is true about the values of the images in each room?"
/ options = ("a) the value of each image is dependent on its quality", "b) the value of each image is determined by the average value of images within that room, and this average
doesn't change", "c) the value of each image is determined by the average value of images within that room,~n and this average can change")
/ optionvalues = ("a", "b", "c")
</radiobuttons>

with

<surveypage questions>
...
/ questions = [1=question1; 2=question2; 3=question3]
/ branch = [
if (radiobuttons.question1.response=="c") surveypage.success else surveypage.fail
]
</surveypage>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search