- Posts: 55
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Mutiple short text - subquestion validation: only letters & only one character
- Vinicos
- Topic Author
- Offline
- Senior Member
Less
More
4 years 2 days ago #197165
by Vinicos
Mutiple short text - subquestion validation: only letters & only one character was created by Vinicos
Hello,
I have a multiple short text question with 3 subquestions. I want all of them to be validated only with letters and I want the first and the third to be validated with one character only. How can I do that?
LS version: 3.17.7+190627
Thanks
I have a multiple short text question with 3 subquestions. I want all of them to be validated only with letters and I want the first and the third to be validated with one character only. How can I do that?
LS version: 3.17.7+190627
Thanks
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
4 years 2 days ago - 4 years 2 days ago #197167
by tpartner
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Mutiple short text - subquestion validation: only letters & only one character
Place this in the "Subquestion validation equation" field:I want all of them to be validated only with letters
Code:
is_empty(this) OR regexMatch('/^[a-zA-Z]+$/', this)
Place this in the "Question validation equation" field (assuming that the first and third sub-question codes are SQ001 and SQ003):I want the first and the third to be validated with one character only
Code:
(is_empty(self.sq_SQ001) OR strlen(self.sq_SQ001) < 2) AND (is_empty(self.sq_SQ003) OR strlen(self.sq_SQ003) < 2)
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 4 years 2 days ago by tpartner.
The topic has been locked.
- Vinicos
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 1
4 years 1 day ago #197189
by Vinicos
Replied by Vinicos on topic Mutiple short text - subquestion validation: only letters & only one character
Thanks again!
It works perfectly.
It works perfectly.
The topic has been locked.