PennController for IBEX › Forums › Support › test.selected() for multiple options › Reply To: test.selected() for multiple options
September 25, 2020 at 4:49 am
#6164
![](https://www.pcibex.net/wp-content/uploads/2019/04/ibex-2-150x150.png)
Participant
Hi Jeremy,
worked like a charm, thanks!
For anybody who finds this post and wants to see how I implemented Jeremy’s response, here’s my code:
newButton("consent", "Continue")
.settings.center()
.print()
.wait(getDropDown("age")
.testNot.selected("17 or younger")
.and( getDropDown("age")
.testNot.selected("32 or older")
)
.and(getDropDown("language")
.test.selected("no")
)
.success() // if '17 or younger' or '32 or older' are NOT selected, and 'no' IS selected, continue as normal
.failure( // otherwise, remove all canvases and display the "bye" text
getCanvas("democanvas")
.remove()
,
getCanvas("agecanvas")
.remove()
,
getCanvas("sexcanvas")
.remove()
,
getCanvas("languagecanvas")
.remove()
,
getCanvas("infocanvastwo")
.remove()
,
getCanvas("infocanvasthree")
.remove()
,
getText("consent")
.remove()
,
getButton("consent")
.remove()
,
newText("bye", "You are ineligible for this study, as you have provided information which is inconsistent with your Prolific prescreening responses. "
+ "<p>Please return your submission on Prolific by selecting the 'Stop without completing' button."
) .print()
)
)
Thanks, Jeremy!
Best,
Daniela