Welcome to the LimeSurvey Community Forum

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

Validation column

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206237 by brais24
Validation column was created by brais24
Hi people, first of all, thanks for the help.

Ive been looking for infomation with this and Im sure I found it on the past but today I cant found the information.

I have an array text question, I attached here, the row name is SQ001, SQ002... and the Column names is COL1,COL2 and COL3, I need to make the column 2 just allow to insert text and the column 3 just allow insert numbers, that is not a problem with regex, but I dont be able to put the correct equation on equation validation and on the tip of equation validation, can you help me, please?

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #206238 by Joffm
Replied by Joffm on topic Validation column
And why don't you send us your sample file?
Please, ease our voluntary work, send us your tries, so we can improve, correct, whatever.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206240 by brais24
Replied by brais24 on topic Validation column
Hi, I try this on validation question equation for the numeric validation

regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",P3_SQ001_COL2)

and this on validation tip

{if((is_empty(P3_SQ001_COL2) or regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",P3_SQ001_COL2)), '', 'Please, insert just integers.')}

But seems like the validation tip on array text works different than a multiple short text, because dont work fine.

related to the question, Im sorry, I cant export the lss file because is a too long survey and still not finished.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #206241 by Joffm
Replied by Joffm on topic Validation column
If you use regexMatch in "Logic" the syntax is:
regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL2)

Analogue in tip:
{if((is_empty(P3_SQ001_COL2) or regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL2)), '', 'Please, insert just integers.')}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206243 by brais24
Replied by brais24 on topic Validation column
It works, but theres a problem, that question is based on previous question, I mean, if you select 1 on a previous question, you just see 1 row on this question, and doing the validation like this, even if the row 2 dont appear, the error message keep showing and dont let you continue with the survey.

How can we fix this?
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206244 by brais24
Replied by brais24 on topic Validation column
I correct myself, if I show the second row the validation let me continue even if I dont insert numbers on the second row




I put this on ecuation validation subquestion
(regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL3)) or (regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ002_COL3))

And this on the tip
{if((is_empty(P3_SQ001_COL3) or regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL3)), '', 'Please, insert just integers.')}<br>
{if((is_empty(P3_SQ002_COL3) or regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ002_COL3)), '', 'Please, insert just integers.')}
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206246 by brais24
Replied by brais24 on topic Validation column
the previous question is called P1, and have 5 choices, from A1 to A5, I supose we have to add that filter to the validation
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206249 by brais24
Replied by brais24 on topic Validation column
I try to put like this

(regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL3)) or (regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL3) AND ((P1.NAOK == "A1")))
OR (regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ001_COL3)) or (regexMatch("/^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/",P3_SQ002_COL3) AND ((P1.NAOK == "A2")))

but doesnt work, any idea?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #206251 by Joffm
Replied by Joffm on topic Validation column
Again:
Better to send your sample.

And we only expact the relevant questions.
So copy the survey, remove everything not related to your question and send the lss export.

Joffm

By the way: If you only want to limit to an integer <=1000, you could use
is_int(Q1_SQ001_COL3.NAOK) and Q1_SQ001_COL3.NAOK le 1000

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206564 by brais24
Replied by brais24 on topic Validation column
Ok, thanks hoffman, Im preparing the lss to send you, meanwhile I have another question, I want to sum a different questions, on this case P1 and P2, 2 multiple numerical input, that is easy to do, but I want use the result of that sum to prefill P3 question wich is another multiple numerical input.

I be able to do it in the title of the P3, but on the default response field the number dont change, keeps on 0 all the time, is there any way to do it?

I attache the survey Lss

File Attachment:

File Name: limesurvey...2893.lss
File Size:26 KB


The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago - 3 years 6 months ago #206570 by tpartner
Replied by tpartner on topic Validation column
That is because the default value is only loaded on page-load, it is not dynamic. Move the third question to a following group.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 6 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 6 months ago #206602 by brais24
Replied by brais24 on topic Validation column
Ok, thanks tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose