PennController for IBEX › Forums › Support › Consent information
- This topic has 3 replies, 2 voices, and was last updated 2 years, 11 months ago by
Jeremy.
-
AuthorPosts
-
March 9, 2022 at 12:57 pm #7851
Mate208
ParticipantHello Jeremy,
In my experience I’m collecting some informations concerning the participants (age, sex gender, education, city…), but I can’t find any way to ”force” them to fill up the boxes ”TextInput”. Here’s a sample of the code ://Participant's informations. newTrial("Variables", defaultText.print() .settings.css("font-size", "1.2em") , newText("INFORMATIONS").css({"font-weight" : "bold"}) .center() .print() , newText(" ") .print() , newText("How old are you? :") .print() , newTextInput("age", "") .print() .log() , newText(" ") .print() , newText(" ") .print() , newText("City", "Where do you live?. ") .print() , newTextInput("CityCity", "") .print() .log() , newButton("Click", "Continue") .center() .css({"margin-top" : "50px"}) .print() .wait() )
Now, we have the possibility to continue without giving any information. Is there any way, by clicking on the button ”Continue”, to let the participants start the experiment only and only if they gave the needed informations?
March 9, 2022 at 1:06 pm #7852Jeremy
KeymasterHi,
Use .test.text to check that the input box is not empty:
//Participant's informations. newTrial("Variables", defaultText.css("font-size", "1.2em").print() , defaultTextInput.log().print() , newText("<p>INFORMATIONS</p>").css("font-weight","bold").center() , newText("How old are you? :").css("margin-top","25px") , newTextInput("age", "") , newText("Where do you live?.").css("margin-top","25px") , newTextInput("city", "") , newButton("Click", "Continue") .center() .css("margin-top","50px") .print() .wait( getTextInput("age").test.text(/\d/).and(getTextInput("city").test.text(/\w/)) ) )
Jeremy
March 9, 2022 at 2:39 pm #7853Mate208
ParticipantHello,
I tryed to code within my ”sample” code and it worked perfectly fine. However, it doesn’t work when I switch to my main script. Among the 5 informations that I asked (using the command ”newTextInput”) to the participants, there are only 4 that they must give (the one I don’t ask is the sex gender).The dots aren’t in the code, they simply indicate that above newButton there were the newTextInputs.
... newButton("Click", "Continuer") .center() .css({"margin-top" : "50px"}) .print() //.wait() .wait( getTextInput("age").test.text(/\d/).and(getTextInput("Residency").test.text(/\w/).and(getTextInput("city").test.text(/\w/).and(getTextInput("L1").test.text(/\w/)) )
March 9, 2022 at 2:49 pm #7854Jeremy
KeymasterThe last line is missing two closing parentheses, at least if you meant to close all the
and
s and thewait
on that lineJeremy
-
AuthorPosts
- You must be logged in to reply to this topic.