PennController for IBEX › Forums › Support › test.selected() for multiple options › Reply To: test.selected() for multiple options
November 15, 2022 at 3:24 pm
#9709
nasimbhmn
Participant
Hi Jeremy,
I am asking my question here because it is relevant to this topic.
I have two questions on a single page and I want to give a warning to participants if they left any of them unanswered before they proceed to the next page. I want the warning message to appear below the question that is unanswered. Everything seems to be working except that if people answer the second question and only forget about the second question, both warning messages appear. It works fine the other way around though.
Here is my code. Could you please help me find the problem?
newTrial("trial1",
newText("Question 1")
.print()
,
newScale("scale1",5)
.before( newText("left", "(<em>totally natural</em>)").css("font-size", "small") )
.after( newText("right", "(<em>totally unnatural</em>)").css("font-size", "small") )
.labelsPosition("top")
.size(200)
.css("max-width", "unset")
.left()
.log()
.print()
,
newText("<br><p>Question 2</p>")
.print()
,
newScale("scale2", "yes", "no", "I'm not sure")
.radio()
.labelsPosition("right")
.vertical()
.print()
.log()
// .wait("first")
,
newButton("proceed","click here to continue")
.cssContainer({"margin-bottom":"3em"})
.cssContainer({"margin-top":"3em"})
.print()
.wait(
getScale("scale1")
.test.selected()
.failure(newText("required1")
.css("position", "relative")
.css("bottom", "270px")
.bold().color("red").print())
.and(
getScale("scale2")
.test.selected()
.failure(newText("required2")
.css("position", "relative")
.css("bottom", "100px")
.bold().color("red").print())
)
)
)
Thanks a lot in advance!
Best, Nasim