Welcome, Guest
Username: Password: Remember me

TOPIC: Validating Numbers and Letters

Validating Numbers and Letters 3 years 9 months ago #56526

  • am91962
  • am91962's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.

Re: Validating Numbers and Letters 3 years 9 months ago #56561

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Validating Numbers and Letters 3 years 9 months ago #56632

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4358
  • Thank you received: 826
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: am91962

Re: Validating Numbers and Letters 3 years 9 months ago #56655

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Validating Numbers and Letters 3 years 9 months ago #56706

  • am91962
  • am91962's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
I am in your debt sir. It worked like a charm.
The administrator has disabled public write access.

Re: Validating Numbers and Letters 3 years 9 months ago #56719

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
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)limesurvey.org'"
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.112 seconds
Donation Image