Check out the LimeSurvey source code on GitHub!

Validating Numbers and Letters

More
6 years 2 weeks ago #56526 by am91962
I use LimeSurvey in a small call center. Many times I'll have a question that requires numeric input, such as the respondent's age. I like to have it set so that the interviewer can only enter numbers between 18 and 100. The problem is I also need them to be able to enter an 'X' for refused (which happens often). So, I need to be able to restrict them to either entering a number between 18 and 100 or the letter X. So far I've been unable to accomplish this using validation. Any help would be greatly appreciated and I apologize in advance if I published in the wrong area.

Thanks,

Andrew

Please Log in to join the conversation.

More
6 years 2 weeks ago #56561 by Mazi
You can use a short text question and use a regular expression for validating the inout: docs.limesurvey.org/Using+regular+expres...tions+for+LimeSurvey


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 2 weeks ago #56632 by tpartner
Try this regex in the "Validation" field:
/^(1[8-9]|[2-9][0-9]|100|[xX])$/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: am91962

Please Log in to join the conversation.

More
6 years 2 weeks ago #56655 by Mazi

tpartner wrote: Try this regex in the "Validation" field:

/^(1[8-9]|[2-9][0-9]|100|[xX])$/

...and if it works fine please add it to the manual page linked above.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 2 weeks ago #56706 by am91962
I am in your debt sir. It worked like a charm.

Please Log in to join the conversation.

More
6 years 2 weeks ago #56719 by Mazi
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form