- Posts: 11
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
VALIDATIONS
- Steven123
- Topic Author
- Offline
- New Member
Less
More
3 years 9 months ago #201764
by Steven123
VALIDATIONS was created by Steven123
Hello!
Kindly help to validate ID number, it should have 9 numbers and the 5th number should be 1 or 2 depending on the gender chosen, 1 for male and 2 for female.
Kindly help to validate ID number, it should have 9 numbers and the 5th number should be 1 or 2 depending on the gender chosen, 1 for male and 2 for female.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
3 years 9 months ago #201768
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic VALIDATIONS
Not necessary to open a new thread.
(QGender==1 and regexMatch('/^[0-9]{4}[1][0-9]{4}$/',self.NAOK)) OR (QGender==2 and regexMatch('/^[0-9]{4}[2][0-9]{4}$/',self.NAOK))
Joffm
(QGender==1 and regexMatch('/^[0-9]{4}[1][0-9]{4}$/',self.NAOK)) OR (QGender==2 and regexMatch('/^[0-9]{4}[2][0-9]{4}$/',self.NAOK))
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- Steven123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 9 months ago #201964
by Steven123
Replied by Steven123 on topic VALIDATIONS
Hello!
Its not working, i used code and answer on my validation area but its not working. see my attached screen shot.
Its not working, i used code and answer on my validation area but its not working. see my attached screen shot.
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
3 years 9 months ago - 3 years 9 months ago #201968
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic VALIDATIONS
Well,
which question type did you use for the gender question?
"gender" or "list(radio)"?
If "list(radio)", which codes did you use?
My example is for a "list(radio)" coded "1 = male, 2 = female"
If you did someting different you have to adapt the validation equation.
AND: you have to enter this in the "question validation equation" in section "Logic".
Joffm
which question type did you use for the gender question?
"gender" or "list(radio)"?
If "list(radio)", which codes did you use?
My example is for a "list(radio)" coded "1 = male, 2 = female"
If you did someting different you have to adapt the validation equation.
AND: you have to enter this in the "question validation equation" in section "Logic".
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 9 months ago by Joffm.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
3 years 9 months ago #201970
by DenisChenu
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.
Replied by DenisChenu on topic VALIDATIONS
Don't use validation : use
Question validation equation
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.
The topic has been locked.
- Steven123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 9 months ago #202337
by Steven123
Replied by Steven123 on topic VALIDATIONS
Hello!
I'm failing to make it work, i have changed to list radio but still failing and i have entered in the validation equation" in section "Logic". See my attachments and advice.
I'm failing to make it work, i have changed to list radio but still failing and i have entered in the validation equation" in section "Logic". See my attachments and advice.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
3 years 9 months ago - 3 years 9 months ago #202351
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic VALIDATIONS
You have used the wrong answer codes.
The validation equation should be:
The validation equation should be:
Code:
(q34 == "A1" and...) OR (q34 == "A2" and...)
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 9 months ago by tpartner. Reason: Typo
The topic has been locked.
- Steven123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 9 months ago #202352
by Steven123
Replied by Steven123 on topic VALIDATIONS
Hello
Still not working see bellow.
(q34=="A1" and regexMatch('/^[0-9]{4}[1][0-9]{4}$/',self.NAOK)) OR (q34=="A2" and regexMatch('/^[0-9]{4}[2][0-9]{4}$/',self.NAOK))
Still not working see bellow.
(q34=="A1" and regexMatch('/^[0-9]{4}[1][0-9]{4}$/',self.NAOK)) OR (q34=="A2" and regexMatch('/^[0-9]{4}[2][0-9]{4}$/',self.NAOK))
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
3 years 9 months ago #202354
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic VALIDATIONS
Obviously you do something wrong.
So instead of saying "doesn't work" you should send your survey as lss export.
How can we know what you do?
Joffm
So instead of saying "doesn't work" you should send your survey as lss export.
How can we know what you do?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Steven123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 9 months ago #202355
by Steven123
Replied by Steven123 on topic VALIDATIONS
Hello!
I have attached.
I have attached.
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
3 years 9 months ago - 3 years 9 months ago #202357
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic VALIDATIONS
1. What is this in q34?
b. q34 (Gender has answer codes "A1" and "A2".
c. You want to validate "omang number".
Though the design of the survey is really bad - you display "group by group", but all questions are in one group.
Better to structure your questionnaire a bit
E.g. one group "address" with multiple short text
And more explanations, what and how to enter data
Okay, "omang number.
If I complete the questionnaire entering a wrong number I get this at the end.
and nobody knows the meaning, where there was an error.
So at least you should enter a hint there
like "Format: XXXX{if(q34=="A1","1","2")}XXXX"
Here something to read about survey design:
www.surveyfriendly.com/ppt/surveyfriendly1.pdf
a. There is no question with code "Gender"(Gender==1 and regexMatch('/^[0-9]{4}[1][0-9]{4}$/',self.NAOK)) OR (Gender==2 and regexMatch('/^[0-9]{4}[2][0-9]{4}$/',self.NAOK))
b. q34 (Gender has answer codes "A1" and "A2".
c. You want to validate "omang number".
Though the design of the survey is really bad - you display "group by group", but all questions are in one group.
Better to structure your questionnaire a bit
E.g. one group "address" with multiple short text
And more explanations, what and how to enter data
Okay, "omang number.
If I complete the questionnaire entering a wrong number I get this at the end.
and nobody knows the meaning, where there was an error.
So at least you should enter a hint there
like "Format: XXXX{if(q34=="A1","1","2")}XXXX"
Here something to read about survey design:
www.surveyfriendly.com/ppt/surveyfriendly1.pdf
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 9 months ago by Joffm.
The topic has been locked.
- Steven123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 9 months ago #202358
by Steven123
Replied by Steven123 on topic VALIDATIONS
Hi!
I want to validate Omang Number depending on what i have selected at q34 which is the code for Gender. I will reorder after the question later
I want to validate Omang Number depending on what i have selected at q34 which is the code for Gender. I will reorder after the question later
The topic has been locked.