Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Excluding certain numbers in Array(text)

  • vzyldd
  • vzyldd's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #187289 by vzyldd
Some guidance please.

I have a question (Array - text) that I need to have only numbers entered in the text box. This I have done with the following validation:

/^([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])$/

This gives me numbers from 1 to 99999

This works fine but I need to exclude the use of numbers 1 and 2. The text field are used for product prices. Unfortunately, the survey is already active and had accumulated data thus I cannot change the question type. The only way I see is to use a validation equation. My knowledge towards validation equations are dangerously inadequate.

Any suggestions?


LimeSurveyVersion 3.17.2+190408
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #187293 by Joffm
Replied by Joffm on topic Excluding certain numbers in Array(text)
Maybe I do not understand.

The lowest price is "3"? You want the numbers from 3 to 99999?
Just change the first from "[1-9]' to '[3-9]'

Or do you generally forbid "1" and "2"? Change the RegExp accordingly. [03456789]


As I said: Probably I misunderstood.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago - 4 years 7 months ago #187300 by DenisChenu
Replied by DenisChenu on topic Excluding certain numbers in Array(text)
Simpliest solution : use Array number
or manual.limesurvey.org/Question_type_-_Ar...y_.28numbers_only.29

And : manual.limesurvey.org/Question_type_-_Ar...8em_validation_sq.29

intval(this.NAOK) == this.NAOK and this.NAOK < 99999 and this.NAOK > 2

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 7 months ago by DenisChenu.
The topic has been locked.
  • vzyldd
  • vzyldd's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #187307 by vzyldd
Replied by vzyldd on topic Excluding certain numbers in Array(text)
Hi Joffm. Thank you for the guidance. I needed to forbid "1" and "2"in general. I changed the RegExp and it is working just fine. Big thank you!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose