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
  • envitera's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #114816 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:
Code:
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:
Code:
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
The topic has been locked.
  • envitera
  • envitera's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #115083 by envitera
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 ?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago - 9 years 3 months ago #115085 by tpartner
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:
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:

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.
Last edit: 9 years 3 months ago by tpartner.
The following user(s) said Thank You: envitera
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115098 by Mazi
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115115 by tpartner
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
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115116 by Mazi
@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
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115117 by DenisChenu

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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • envitera
  • envitera's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #115471 by envitera
@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.
The topic has been locked.
  • envitera
  • envitera's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 3 months ago #115474 by envitera
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115480 by tpartner
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
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115506 by Mazi

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

Current (Dec. 2014) configuration at Limeservice is:
- 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.

Lime-years ahead

Online-surveys for every purse and purpose