Sub-question date validation fails when array filtering is set

More
2 years 11 months ago #114816 by envitera
envitera created the topic: Sub-question date validation fails when array filtering is set
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) or regexMatch('/^(0?[1-9]|1[0-2])\/([0-2]\d\d\d)$/',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:
count(that.q1.sq_1)*2
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.


File Attachment:

File Name: limesurvey...1264.lss
File Size:27 KB
Attachments:

Please Log in to join the conversation.

More
2 years 11 months ago #115083 by envitera
envitera replied the 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 ?

Please Log in to join the conversation.

More
2 years 11 months ago - 2 years 11 months ago #115085 by tpartner
tpartner replied the 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:
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):
regexMatch('/^(0?[1-9]|1[0-2])\/([0-2]\d\d\d))/',this.NAOK)


Survey attached:

File Attachment:

File Name: limesurvey...2874.lss
File Size:28 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 2 years 11 months ago by tpartner.
The following user(s) said Thank You: envitera

Please Log in to join the conversation.

More
2 years 11 months ago #115098 by Mazi
Mazi replied the 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
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
2 years 11 months ago #115115 by tpartner
tpartner replied the 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.

Please Log in to join the conversation.

More
2 years 11 months ago #115116 by Mazi
Mazi replied the 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.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
2 years 11 months ago #115117 by DenisChenu
DenisChenu replied the topic: Sub-question date validation fails when array filtering is set

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.

It's the .NAOK the solution ? Becuse it's seems to be in manual:

.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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
2 years 11 months ago #115471 by envitera
envitera replied the 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.

Please Log in to join the conversation.

More
2 years 11 months ago #115474 by envitera
envitera replied the topic: Sub-question date validation fails when array filtering is set
Can somebody direct me to the phpinfo of the LimeSurvey Professional (previously LimeService) hosting server? Otherwise I'm not able to correctly fill in the bug report.

Please Log in to join the conversation.

More
2 years 11 months ago #115480 by tpartner
tpartner replied the 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 LimeSurvey Professional (previously LimeService) server.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 11 months ago #115506 by Mazi
Mazi replied the topic: Sub-question date validation fails when array filtering is set

tpartner wrote: Don't worry about those inputs. Just enter fake values and indicate that you are using the LimeSurvey Professional (previously LimeService) server.

Current (Dec. 2014) configuration at LimeSurvey Professional (previously LimeService) is:
- PHP 5.3.2
- Cheeroke webserver
- MySQl 5.1.73


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!