- Posts: 20
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Sub-question date validation fails when array filtering is set
- envitera
- Topic Author
- Offline
- Junior Member
Less
More
9 years 5 months ago #114816
by envitera
Sub-question date validation fails when array filtering is set was created by envitera
I have been testing this sub-question validation for a while now and brought it to almost perfectly working state. There is one issue left, enough important to explain it this post.
The validation is created with a help of regexp ^(0?[1-9]|1[0-2])\/([0-2]\d\d\d)$, which in sub-question validation field looks like this:
is_empty(this) is used to validate all the fields non relevant to q1 - to pass the rest of the fields not linked with entered data from q1
Until here and beyond everything works well. In q2 we enter start-date and end-date. To limit the maximum amount of dates entered there is a minimum answers limit:
This comes very handy for enabling the input of dates only for the non-empty fields from q1.
As there are all the lines shown in q2 (see the image above), even those non related to the data from q1, using of Array filtering is necessary to:
1. create a proper design of the question and
2. (more important) to not let the user achieving the minimum answers limit by filling the dates in non pertinent fields (lines non related to data from q1)
But at this point, when array filtering comes forth the logic for sq-validation fails. I have no clue how to make this work. I've attached the survey example if someone can take a look into this (to raise the issue array filtering has to be set in q2). Thanks for the propositions!
Of course, if a array-multi-date type of question existed, that would be the nicest solution. Maybe another idea for future LS development.
The validation is created with a help of regexp ^(0?[1-9]|1[0-2])\/([0-2]\d\d\d)$, which in sub-question validation field looks like this:
Code:
is_empty(this) or regexMatch('/^(0?[1-9]|1[0-2])\/([0-2]\d\d\d)$/',this)
Until here and beyond everything works well. In q2 we enter start-date and end-date. To limit the maximum amount of dates entered there is a minimum answers limit:
Code:
count(that.q1.sq_1)*2
As there are all the lines shown in q2 (see the image above), even those non related to the data from q1, using of Array filtering is necessary to:
1. create a proper design of the question and
2. (more important) to not let the user achieving the minimum answers limit by filling the dates in non pertinent fields (lines non related to data from q1)
But at this point, when array filtering comes forth the logic for sq-validation fails. I have no clue how to make this work. I've attached the survey example if someone can take a look into this (to raise the issue array filtering has to be set in q2). Thanks for the propositions!
Of course, if a array-multi-date type of question existed, that would be the nicest solution. Maybe another idea for future LS development.
Attachments:
The topic has been locked.
- envitera
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
9 years 4 months ago #115083
by envitera
Replied by envitera on topic Sub-question date validation fails when array filtering is set
I don't use anymore minimum/maximum amount of answers to control empty and full fields in q2. I've done that using function count() in "Question validation equation" which prevents users to write in fields without the dataset correspondence from q1.
But! If I try to use the filtering the logic malfunctions. So my question stays the same - How to use array filtering without breaking up the sub-question validation equation and/or question validation equation logic?
Is this an issue or is there something very obvious that I missed in help documentation ?
But! If I try to use the filtering the logic malfunctions. So my question stays the same - How to use array filtering without breaking up the sub-question validation equation and/or question validation equation logic?
Is this an issue or is there something very obvious that I missed in help documentation ?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
9 years 4 months ago - 9 years 4 months ago #115085
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 Sub-question date validation fails when array filtering is set
Try this...
1) Filter Q2 by Q1 (as you have done)
2) Add this relevance to Q2 so it only appears if there is something in Q1:
3) Make Q2 mandatory (this will ensure that every visible row is populated)
4) Use this as the sub-question validation equation for Q2 (the .NAOK allows for sub-questions hidden by filtering):
Survey attached:
1) Filter Q2 by Q1 (as you have done)
2) Add this relevance to Q2 so it only appears if there is something in Q1:
Code:
count(that.q1) > 0
3) Make Q2 mandatory (this will ensure that every visible row is populated)
4) Use this as the sub-question validation equation for Q2 (the .NAOK allows for sub-questions hidden by filtering):
Code:
regexMatch('/^(0?[1-9]|1[0-2])\/([0-2]\d\d\d))/',this.NAOK)
Survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 9 years 4 months ago by tpartner.
The following user(s) said Thank You: envitera
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
9 years 4 months ago #115098
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sub-question date validation fails when array filtering is set
Tony, do you consider this a bug? Then zer0mode should file a bug report at the bugtracker.
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
9 years 4 months ago #115115
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 Sub-question date validation fails when array filtering is set
Yeah, in my opinion it probably is. If an array row is hidden by filtering it should be totally excluded from the survey so sub-question validation should not be applied.
.
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
9 years 4 months ago #115116
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sub-question date validation fails when array filtering is set
@zer0mode, please file a bug report at the Limesurvey bugtracker and attach your survey for testing
@Tony, thanks for sharing your thoughts and your great workaround.
@Tony, thanks for sharing your thoughts and your great workaround.
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
9 years 4 months ago #115117
by DenisChenu
And manual.limesurvey.org/Expression_Manager...Cascading_Conditions
Denis
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 Sub-question date validation fails when array filtering is set
It's the .NAOK the solution ? Becuse it's seems to be in manual:tpartner wrote: Yeah, in my opinion it probably is. If an array row is hidden by filtering it should be totally excluded from the survey so sub-question validation should not be applied.
.NAOK - same as .code, but can be part of calculations or lists even if irrelevant
And manual.limesurvey.org/Expression_Manager...Cascading_Conditions
Denis
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.
- envitera
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
9 years 4 months ago #115471
by envitera
Replied by envitera on topic Sub-question date validation fails when array filtering is set
@Tony thanks! Your intervention was helpful and I adapted it for my case. It works.
Though I don't really understand which way to chose to design questions with similar logic. Yours works, mine did not. Well, if it's a bug, then this explains all.
@Mazi. I'll do that.
@Denis, I thought by just applying .NAOK in my survey example would help. But it didn't. I had to redesign the conditions as Tony suggested.
Though I don't really understand which way to chose to design questions with similar logic. Yours works, mine did not. Well, if it's a bug, then this explains all.
@Mazi. I'll do that.
@Denis, I thought by just applying .NAOK in my survey example would help. But it didn't. I had to redesign the conditions as Tony suggested.
The topic has been locked.
- envitera
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
- Thank you received: 0
9 years 4 months ago #115474
by envitera
Replied by envitera on topic Sub-question date validation fails when array filtering is set
Can somebody direct me to the phpinfo of the limeservice hosting server? Otherwise I'm not able to correctly fill in the bug report.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
9 years 4 months ago #115480
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 Sub-question date validation fails when array filtering is set
Don't worry about those inputs. Just enter fake values and indicate that you are using the LimeService server.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
9 years 4 months ago #115506
by Mazi
- PHP 5.3.2
- Cheeroke webserver
- MySQl 5.1.73
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Sub-question date validation fails when array filtering is set
Current (Dec. 2014) configuration at Limeservice is:tpartner wrote: Don't worry about those inputs. Just enter fake values and indicate that you are using the LimeService server.
- PHP 5.3.2
- Cheeroke webserver
- MySQl 5.1.73
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.