Millisecond Forums

/branch = [if (texbox.mybox1.response == text.mytext1.currentitem) trial.3 else trial.4] is not working =( - Why?

https://forums.millisecond.com/Topic14998.aspx

By july1810 - 11/14/2014

Hello,
I have a surveypage with one textbox. Depending on whether or not the string entered here matches an Item from an item list contained in a text, I like to present different consecutive trials. However, although textbook.mybox1.response and text.mytext1.currentitem contain the same word/string this command does not work =( Can you tell me what I've done wrong?
Thank U 
By Dave - 11/14/2014

Since you did not provide your actual code, it is not possible to tell what you did wrong. What I can tell you is that it works perfectly fine if done correctly:

<block myblock>
/ trials = [1-3=mypage]
</block>

<surveypage mypage>
/ stimulusframes = [1=mytext]
/ questions = [1=mytextbox]
/ branch = [if (textbox.mytextbox.response == text.mytext.currentitem) trial.match else trial.nomatch]
</surveypage>

<textbox mytextbox>
</textbox>

<text mytext>
/ items = ("A", "B", "C")
</text>

<trial match>
/ stimulusframes = [1=matchtext]
/ validresponse = (57)
</trial>

<trial nomatch>
/ stimulusframes = [1=nomatchtext]
/ validresponse = (57)
</trial>

<text matchtext>
/ items = ("Your response matched the displayed text.")
</text>

<text nomatchtext>
/ items = ("Your response did *not* match the displayed text.")
</text>