Welcome to the LimeSurvey Community Forum

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

Regex question validation, error when decimal number ends in 0

  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 9 months ago #217341 by jackrabbithanna
I've got a Array(Text) type question, 4 subquestions.

For the question validation, this regex: /^(?=.*[1-9])[0-9]*[.,]?[0-9]{1,2}$/

For some reason, this will cause the error condition if the number ends in a decimal with 0.
So 14.5 gives no error, but 14.50 does result in error

Trying this expression out on regexr.com finds a match, where apparently LS does not.

In advanced settings for the question, "Only Numbers" = No

The validation error message should be "The answer entered should be a number greater than zero with a maximum of two decimal places." .. but no message appears for this condition.

Version 2.6.7-lts Build 171212

Any ideas why this could be? Thanks in advance!
 
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 9 months ago #217344 by jackrabbithanna
We have a question validation tip equation, and without this, the error does not manifest:
{if(( (!is_empty(G6S5Q4_SQ001_SQ003.NAOK)) and (!is_empty(G6S5Q4_SQ001_SQ002.NAOK)) and (G6S5Q4_SQ001_SQ003.NAOK > G6S5Q4_SQ001_SQ002.NAOK) ), '4c must be less than or equal to 4b for Quarter 1 2020.||', '' )}
{if(( (!is_empty(G6S5Q4_SQ002_SQ003.NAOK)) and (!is_empty(G6S5Q4_SQ002_SQ002.NAOK)) and (G6S5Q4_SQ002_SQ003.NAOK > G6S5Q4_SQ002_SQ002.NAOK) ), '4c must be less than or equal to 4b for Quarter 2 2020.||', '' )}
{if(( (!is_empty(G6S5Q4_SQ003_SQ003.NAOK)) and (!is_empty(G6S5Q4_SQ003_SQ002.NAOK)) and (G6S5Q4_SQ003_SQ003.NAOK > G6S5Q4_SQ003_SQ002.NAOK) ), '4c must be less than or equal to 4b for Quarter 3 2020.||', '' )}
{if(( (!is_empty(G6S5Q4_SQ004_SQ003.NAOK)) and (!is_empty(G6S5Q4_SQ004_SQ002.NAOK)) and (G6S5Q4_SQ004_SQ003.NAOK > G6S5Q4_SQ004_SQ002.NAOK) ), '4c must be less than or equal to 4b for Quarter 4 2020.||', '' )}
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose