- Posts: 48
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Subquestion validation equation for multiple short text question
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
2 months 3 weeks ago #255560
by ngolub
Subquestion validation equation for multiple short text question was created by ngolub
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.4.0+231218
Own server or LimeSurvey hosting: own server
Survey theme/template: bootstrap vanilla
==================
Hi I have a multiple short text type question and am trying to create a subquestion that will only allow numerical input.
My question's code is: "vorherigePos" and my subquestion code is "3".
I have tried this expression in the subquestion validation equation field but it did not work: preg_match('/^[0-9]+$/', vorherigePos_3.NAOK)
Can you help me find the correct code for this?
Thank you!
Your LimeSurvey version: LimeSurvey Community Edition Version 6.4.0+231218
Own server or LimeSurvey hosting: own server
Survey theme/template: bootstrap vanilla
==================
Hi I have a multiple short text type question and am trying to create a subquestion that will only allow numerical input.
My question's code is: "vorherigePos" and my subquestion code is "3".
I have tried this expression in the subquestion validation equation field but it did not work: preg_match('/^[0-9]+$/', vorherigePos_3.NAOK)
Can you help me find the correct code for this?
Thank you!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 3 weeks ago #255561
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Subquestion validation equation for multiple short text question
Hi,
"preg_match" is not a valid function in LimeSurvey.
Please, read the manual about "implemented functions"
Joffm
"preg_match" is not a valid function in LimeSurvey.
Please, read the manual about "implemented functions"
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: ngolub
Please Log in to join the conversation.
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
2 months 3 weeks ago - 2 months 3 weeks ago #255562
by ngolub
Replied by ngolub on topic Subquestion validation equation for multiple short text question
Thank you, will do! Do you happen to know what the correct validation equation would be for this problem?
I have tried this as well: regexMatch("/^[1-9][0-9]{0,4}$/", vorherigePos_3)
I have tried this as well: regexMatch("/^[1-9][0-9]{0,4}$/", vorherigePos_3)
Last edit: 2 months 3 weeks ago by ngolub.
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
2 months 3 weeks ago #255565
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 Subquestion validation equation for multiple short text question
Seems OK, maybe regexMatch("/^[1-9][0-9]{0,4}$/", vorherigePos_3.NAOK) ?
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 following user(s) said Thank You: ngolub
Please Log in to join the conversation.
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
2 months 3 weeks ago #255566
by ngolub
Replied by ngolub on topic Subquestion validation equation for multiple short text question
Thank you. I tried that, but unfortunately, it did not work.
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
2 months 3 weeks ago #255567
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Subquestion validation equation for multiple short text question
What does "it did not work" mean exactly? What is the exact issue?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
2 months 3 weeks ago - 2 months 3 weeks ago #255568
by ngolub
Replied by ngolub on topic Subquestion validation equation for multiple short text question
Last edit: 2 months 3 weeks ago by ngolub.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 3 weeks ago #255569
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Subquestion validation equation for multiple short text question
Yes, always try with something simple and test your equations by inserting them into the question text (with curly brackets)
You will find that "regexMatch" does not support this construct {0,4}
So an easy first workaround is
regexMatch("/^[1-9][0-9]*$/", Q1_3.NAOK) and Q1_3<100000
But here you get an initial error while the cell is still empty.
So add this and it is fine.
is_empty(Q1_3) or (regexMatch("/^[1-9][0-9]*$/", Q1_3.NAOK) and Q1_3<100000)
Or you only use comparisons like
is_empty(Q1_3) or (Q1_3>0 and Q1_3<100000)
Joffm
You will find that "regexMatch" does not support this construct {0,4}
So an easy first workaround is
regexMatch("/^[1-9][0-9]*$/", Q1_3.NAOK) and Q1_3<100000
But here you get an initial error while the cell is still empty.
So add this and it is fine.
is_empty(Q1_3) or (regexMatch("/^[1-9][0-9]*$/", Q1_3.NAOK) and Q1_3<100000)
Or you only use comparisons like
is_empty(Q1_3) or (Q1_3>0 and Q1_3<100000)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: ngolub
Please Log in to join the conversation.
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
2 months 3 weeks ago #255577
by ngolub
Replied by ngolub on topic Subquestion validation equation for multiple short text question
Thank you very much; this worked like a charm!
I have two follow-up questions:
1. Now, if a survey participant does not enter a number, a message appears saying they cannot proceed. How can I edit the text in the message?
2. All the response fields of the question are highlighted in red if the input is character instead of numeric. Is it possible to only have subquestion 3 highlighted in red, since 1 and 2 may have characters as input?
Thank you!
I have two follow-up questions:
1. Now, if a survey participant does not enter a number, a message appears saying they cannot proceed. How can I edit the text in the message?
2. All the response fields of the question are highlighted in red if the input is character instead of numeric. Is it possible to only have subquestion 3 highlighted in red, since 1 and 2 may have characters as input?
Thank you!
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 3 weeks ago #255580
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Subquestion validation equation for multiple short text question
1. What is wrong with this message?
You have a question validation tip that shows an error if the respondent enters something not valid.
If he ignores this and tries to proceed the above message is displayed.
Nevertheless,
maybe this helps
[url] forums.limesurvey.org/forum/design-issue...soft-warning-message [/url]
2. Yes, obvious, because the question validation fails. So the entire question is marked red.
You can redesign the question to show the error only in the subquestion,
but - to be honest - I am tired to answer here in English without necessity.
Ask it in the German part and we can discuss it without language gap
Joffm
You have a question validation tip that shows an error if the respondent enters something not valid.
If he ignores this and tries to proceed the above message is displayed.
Nevertheless,
maybe this helps
[url] forums.limesurvey.org/forum/design-issue...soft-warning-message [/url]
2. Yes, obvious, because the question validation fails. So the entire question is marked red.
You can redesign the question to show the error only in the subquestion,
but - to be honest - I am tired to answer here in English without necessity.
Ask it in the German part and we can discuss it without language gap
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: ngolub
Please Log in to join the conversation.
- ngolub
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
2 months 3 weeks ago #255610
by ngolub
Replied by ngolub on topic Subquestion validation equation for multiple short text question
Thank you very much for your help!
Next time, I will ask in the German forum (I am new to LimeSurvey and did not even know that the German forum existed).
Next time, I will ask in the German forum (I am new to LimeSurvey and did not even know that the German forum existed).
Please Log in to join the conversation.