- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Short text question validation: First sign must be capital letter second number
- Otto12345
- Topic Author
- Offline
- New Member
Less
More
6 years 9 months ago #155403
by Otto12345
Short text question validation: First sign must be capital letter second number was created by Otto12345
Hi,
I would like to create the following validation criteria for "Short free text" question: first sign must be capital letter A-Z and second sign must be number 0-9, everything else can be numbers. Is it possible to do this from the menu "Edit question -> Advanced settings -> Question validation equation"?
I tried some of the examples equations that are mentioned in the limesurvey manual but for some reason I could not get them to work (even when I just copypasted them). I would really appreciate if you would be able to tell me what I need to type in the "Question validation equation" box to get the rule working. Thank you in advance!
I would like to create the following validation criteria for "Short free text" question: first sign must be capital letter A-Z and second sign must be number 0-9, everything else can be numbers. Is it possible to do this from the menu "Edit question -> Advanced settings -> Question validation equation"?
I tried some of the examples equations that are mentioned in the limesurvey manual but for some reason I could not get them to work (even when I just copypasted them). I would really appreciate if you would be able to tell me what I need to type in the "Question validation equation" box to get the rule working. Thank you in advance!
The topic has been locked.
- steve_81
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 37
6 years 9 months ago - 6 years 9 months ago #155407
by steve_81
Replied by steve_81 on topic Short text question validation: First sign must be capital letter second number
Hello,
try this:
/^[A-Z][0-9]/
try this:
/^[A-Z][0-9]/
Last edit: 6 years 9 months ago by steve_81. Reason: ^ for starting at first position
The topic has been locked.
- Otto12345
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
6 years 9 months ago #155409
by Otto12345
Replied by Otto12345 on topic Short text question validation: First sign must be capital letter second number
Attachments:
The topic has been locked.
- steve_81
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 37
6 years 9 months ago #155411
by steve_81
Replied by steve_81 on topic Short text question validation: First sign must be capital letter second number
Attachments:
The topic has been locked.
- steve_81
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 37
6 years 9 months ago #155412
by steve_81
Replied by steve_81 on topic Short text question validation: First sign must be capital letter second number
Attachments:
The topic has been locked.
- Otto12345
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
6 years 9 months ago #155413
by Otto12345
Replied by Otto12345 on topic Short text question validation: First sign must be capital letter second number
Thanks for the quick reply. It's working now! I was typing the equation into a wrong field like you said
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 9 months ago - 6 years 9 months ago #155416
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Short text question validation: First sign must be capital letter second number
You can use either the "Validation" or the "Question validation equation" fields. The "Question validation equation" allows for far greater flexibility in the validation criteria but requires the use of Expression Manager syntax.
Something like this (which also restricts any characters after the first two to be numeric):
Something like this (which also restricts any characters after the first two to be numeric):
Code:
regexMatch("/^[A-Z][0-9][0-9]*$/", this)
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 9 months ago by tpartner.
The following user(s) said Thank You: Otto12345
The topic has been locked.