Welcome to the LimeSurvey Community Forum

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

Validation for multiple array options

  • sbcha28
  • sbcha28's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 weeks ago #181620 by sbcha28
Validation for multiple array options was created by sbcha28
We used the array (texts) question type to create the attached question. Is there a way to restrict just one of the columns as numeric entry only? In our case, hoping to restrict the middle column to numeric entries only.
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago #181621 by Joffm
Replied by Joffm on topic Validation for multiple array options
Hi,
well, it's exactly as you say it:
The entries of the column have to be numeric.
...
So you use the function "is_numeric(Q1_SQ001_X002) AND is_numeric(Q1_SQ002_X002) ..." where X002 is the code of the second column.

Or you can use Regular expressions.

Everything you find in the manual.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 weeks ago #181624 by Joffm
Replied by Joffm on topic Validation for multiple array options
BTW:

The solution with regular expression could be:

For whole numbers (not starting with "0")
Question validation equation:
(regexMatch("/^[1-9][0-9]{0,}$/",self.sq_SQ001_X002) OR is_empty(self.sq_SQ001_X002)) AND
(regexMatch("/^[1-9][0-9]{0,}$/",self.sq_SQ002_X002) OR is_empty(self.sq_SQ002_X002)) AND
...

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose