20jkim2
|
|
Group: Forum Members
Posts: 2,
Visits: 4
|
Hi, I am using the textbox function and am trying to constrain the answers to be capitalized. This is the current code, but I want to make it so that unless the answer (their first name) is capitalized, the participants cannot move on. How would I make this happen?
<textbox name> / caption = "Please enter your first name. Be mindful of capitalization." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox>
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+xHi, I am using the textbox function and am trying to constrain the answers to be capitalized. This is the current code, but I want to make it so that unless the answer (their first name) is capitalized, the participants cannot move on. How would I make this happen? <textbox name> / caption = "Please enter your first name. Be mindful of capitalization." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox> You could write a regular expression to force capitalization and use that in /mask. However, the much friendlier way is to simply allow participants to enter their first name however they want and then apply normalization to the response (e.g. toLower() followed by capitalize()).
|
|
|
20jkim2
|
|
Group: Forum Members
Posts: 2,
Visits: 4
|
+x+xHi, I am using the textbox function and am trying to constrain the answers to be capitalized. This is the current code, but I want to make it so that unless the answer (their first name) is capitalized, the participants cannot move on. How would I make this happen? <textbox name> / caption = "Please enter your first name. Be mindful of capitalization." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox> You could write a regular expression to force capitalization and use that in /mask. However, the much friendlier way is to simply allow participants to enter their first name however they want and then apply normalization to the response (e.g. toLower() followed by capitalize()). Sorry, I am a beginner to Inquisit, so I'm not sure how to do what you suggested. Could you tell me how to code it
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+xHi, I am using the textbox function and am trying to constrain the answers to be capitalized. This is the current code, but I want to make it so that unless the answer (their first name) is capitalized, the participants cannot move on. How would I make this happen? <textbox name> / caption = "Please enter your first name. Be mindful of capitalization." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox> You could write a regular expression to force capitalization and use that in /mask. However, the much friendlier way is to simply allow participants to enter their first name however they want and then apply normalization to the response (e.g. toLower() followed by capitalize()). Sorry, I am a beginner to Inquisit, so I'm not sure how to do what you suggested. Could you tell me how to code it <block exampleBlock> / trials = [1=pageOne; 2=pageTwo] </block>
<surveyPage pageOne> / questions = [1=name] / showPageNumbers = false / showQuestionNumbers = false </surveypage>
<textbox name> / caption = "Please enter your first name." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox>
<surveyPage pageTwo> / caption = "Raw input: <%textbox.name.response%> Normalized: <%capitalize(toLower(textbox.name.response))%>" / showPageNumbers = false / showQuestionNumbers = false </surveypage> Given that you are new to working wiht Inquisit syntax, please work through the Programmer's Manual: https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+x+xHi, I am using the textbox function and am trying to constrain the answers to be capitalized. This is the current code, but I want to make it so that unless the answer (their first name) is capitalized, the participants cannot move on. How would I make this happen? <textbox name> / caption = "Please enter your first name. Be mindful of capitalization." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox> You could write a regular expression to force capitalization and use that in /mask. However, the much friendlier way is to simply allow participants to enter their first name however they want and then apply normalization to the response (e.g. toLower() followed by capitalize()). Sorry, I am a beginner to Inquisit, so I'm not sure how to do what you suggested. Could you tell me how to code it <block exampleBlock> / trials = [1=pageOne; 2=pageTwo] </block>
<surveyPage pageOne> / questions = [1=name] / showPageNumbers = false / showQuestionNumbers = false </surveypage>
<textbox name> / caption = "Please enter your first name." / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox>
<surveyPage pageTwo> / caption = "Raw input: <%textbox.name.response%> Normalized: <%capitalize(toLower(textbox.name.response))%>" / showPageNumbers = false / showQuestionNumbers = false </surveypage> Given that you are new to working wiht Inquisit syntax, please work through the Programmer's Manual: https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf And if you prefer to force the first letter to be entered capitalized instead of doing normalization after the fact, you can do: <textbox name> / caption = "Please enter your first name." / mask = ^[A-Z].* / txcolor = dimgray / position = (35%, 35%) / fontstyle = ("Arial", 2%, true, false, false, false, 5, 0) / textboxsize = (25,5) </textbox>
|
|
|