Welcome to the LimeSurvey Community Forum

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

Multiple Short Text validation on one field / Regex help needed

  • dleger
  • dleger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 6 months ago #112170 by dleger
So I'm trying to validate only 1 field in a multiple short text question.

I am using v 1.95

I found this page with a decription of what is required...

manual.limesurvey.org/Question_type_-Arr...28em_validation_q.29

I tried to adapt the example in the screenshot, but I seem to be running into issues.

A: Where would I put the vaildation equation... in the question validation equation or the sub-question validation equation ?

B: This is the equation I wrote... Does anyone see what I did wrong? Where cust1_7pc is the question code.

Question validation equation
(regexmatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_7pc))

Question validation tip
if (regexmatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_7pc)),",'postal code format< br/>')
The topic has been locked.
  • dleger
  • dleger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 6 months ago #112191 by dleger
after multiple trial and errors, I managed to fix it... There were syntax errors in the original sample code.

A: It was in the question validation equation / tip it should be placed


B: here is the syntax
Question validation equation
regexMatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_custSQ7)


Question validation tip
{if(regexMatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_custSQ7)," ","Please enter a valid postal code. Format is A1A 1A1")}
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose