Consent information

PennController for IBEX Forums Support Consent information

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7851
    Mate208
    Participant

    Hello 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?

    #7852
    Jeremy
    Keymaster

    Hi,

    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

    #7853
    Mate208
    Participant

    Hello,
    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/)) )
        
    #7854
    Jeremy
    Keymaster

    The last line is missing two closing parentheses, at least if you meant to close all the ands and the wait on that line

    Jeremy

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.