You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use the jspsychSurvey plugin to get basic demographics. I would like to use the text type to get age and perform basic validation that the participant a) indicated a number and b) indicated a number between 18-120. The text type has a validation argument that used regex to match the inputted text. I have set up the plugin like so:
const demos = {
type: jsPsychSurvey,
pages: [
[
{
type: 'text',
prompt: "Please enter your age in a number format",
placeholder: '(e.g., 25)',
name: 'age',
required: true,
validation: '^(?:1[01][0-9]|120|1[8-9]|[2-9][0-9])$'
},
]
};
While the plugin works as expected, I get the following warning in the console:
Warning in survey plugin: the following question parameters have been specified but are not allowed for the question type "text" and will be ignored: validation
And it indeed doesn't do any validation on the inputted data. Am I missing something? Any help would be greatly appreciated! Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am attempting to use the
jspsychSurvey
plugin to get basic demographics. I would like to use thetext
type to get age and perform basic validation that the participant a) indicated a number and b) indicated a number between 18-120. Thetext
type has avalidation
argument that used regex to match the inputted text. I have set up the plugin like so:While the plugin works as expected, I get the following warning in the console:
And it indeed doesn't do any validation on the inputted data. Am I missing something? Any help would be greatly appreciated! Thanks!
Beta Was this translation helpful? Give feedback.
All reactions