Error message for textboxes


Author
Message
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
anabela_c - 5/19/2021
Hi all! When I present a surveypage containing 2 textboxes I need participants to be only allowed to introduce values that sum 5 in total (not higher nor lower, e.g. 2 and 3), if they introduce values different than 5 I would like them to see a text indicating the error so they can correct it. I have tried as follows:

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = OfferPic, CoalitionOfferText, OfferBoxYou, OfferBoxPartner]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ finishlabel = "Click here to continue"
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response != 5) text.erroroffer]
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response == 5) likert.Liking1]
</surveypage>

<text erroroffer>
/ items = ("please introduce the correct values")
/ color = (0, 255, 0)
/ fontstyle = ("Arial", 3%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

In this case, If they introduce “5 and 6” they are not allowed to continue but the error message is not displayed. And f they type “5 and 4” they move to the next page "likert.liking1".

Thank you in advance for your help!!
Anabela

A <text> element is not something you can /branch to. You may  /branch to a <trial> displaying that <text>.
AKrishna
AKrishna
Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)Distinguished Member (3.8K reputation)
Group: Forum Members
Posts: 118, Visits: 396
anabela_c - 5/19/2021
Hi all! When I present a surveypage containing 2 textboxes I need participants to be only allowed to introduce values that sum 5 in total (not higher nor lower, e.g. 2 and 3), if they introduce values different than 5 I would like them to see a text indicating the error so they can correct it. I have tried as follows:

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = OfferPic, CoalitionOfferText, OfferBoxYou, OfferBoxPartner]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ finishlabel = "Click here to continue"
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response != 5) text.erroroffer]
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response == 5) likert.Liking1]
</surveypage>

<text erroroffer>
/ items = ("please introduce the correct values")
/ color = (0, 255, 0)
/ fontstyle = ("Arial", 3%, true)
/ position = (50%,50%)
/ vjustify = center
</text>


In this case, If they introduce “5 and 6” they are not allowed to continue but the error message is not displayed. And f they type “5 and 4” they move to the next page "likert.liking1".

Thank you in advance for your help!!
Anabela

Hi,

I'm not an Inquisit professional, but I've had the same problem in the past. Inquisit can't parse a stimulus element (like "text.erroroffer") as a consequence of a branch. One way of solving this is to have the branch point to the same trial (i.e. restart the trial) and make the message visible at the same time, like this for example:


<text erroroffer>
/ items = ("please introduce the correct values")
/ color = (0, 255, 0)
/ fontstyle = ("Arial", 3%, true)
/ position = (50%,50%)
/ vjustify = center

/txcolor = transparent

</text>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = OfferPic, CoalitionOfferText, OfferBoxYou, OfferBoxPartner]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ finishlabel = "Click here to continue"
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response != 5) {text.erroroffer.txcolor = red; textbox.OfferBox1.defaultresponse = textbox.OfferBox1.response; textbox.OfferBox2.defaultresponse = textbox.OfferBox2.response; surveypage.CoalitionOffer}]
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response == 5) {text.erroroffer.txcolor = transparent; textbox.OfferBox1.defaultresponse = values.YourOriginalDefault1; textbox.OfferBox2.defaultresponse = values.YourOriginalDefault2; likert.Liking1}]
</surveypage>



I haven't tested this, but the code should return a participant to the same surveypage if they make an invalid entry, display your warning in red and retain the responses they just entered. Hope this helps!

anabela_c
anabela_c
Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)Respected Member (386 reputation)
Group: Forum Members
Posts: 23, Visits: 75
Hi all! When I present a surveypage containing 2 textboxes I need participants to be only allowed to introduce values that sum 5 in total (not higher nor lower, e.g. 2 and 3), if they introduce values different than 5 I would like them to see a text indicating the error so they can correct it. I have tried as follows:

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = OfferPic, CoalitionOfferText, OfferBoxYou, OfferBoxPartner]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ finishlabel = "Click here to continue"
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response != 5) text.erroroffer]
/ branch = [if (textbox.OfferBox1.response + textbox.OfferBox2.response == 5) likert.Liking1]
</surveypage>

<text erroroffer>
/ items = ("please introduce the correct values")
/ color = (0, 255, 0)
/ fontstyle = ("Arial", 3%, true)
/ position = (50%,50%)
/ vjustify = center
</text>

In this case, If they introduce “5 and 6” they are not allowed to continue but the error message is not displayed. And f they type “5 and 4” they move to the next page "likert.liking1".

Thank you in advance for your help!!
Anabela

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search