Welcome, Guest
Username: Password:

TOPIC: Validating Numbers and Letters

Validating Numbers and Letters 5 years 3 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.

Validating Numbers and Letters 5 years 3 months ago #56561

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5964
  • Thank you received: 364
  • Karma: 259
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.

Validating Numbers and Letters 5 years 3 months ago #56632

  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Team
  • Posts: 5899
  • Thank you received: 1291
  • Karma: 520
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 administrator has disabled public write access.
The following user(s) said Thank You: am91962

Validating Numbers and Letters 5 years 3 months ago #56655

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5964
  • Thank you received: 364
  • Karma: 259
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.

Validating Numbers and Letters 5 years 3 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.

Validating Numbers and Letters 5 years 3 months ago #56719

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5964
  • Thank you received: 364
  • Karma: 259
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.200 seconds