Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

validation equation and suggestion work in one array and don't in another one

  • CarlottaToletti
  • CarlottaToletti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 6 months ago #232409 by CarlottaToletti
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 5.3.16
Own server or LimeSurvey hosting: LimeSurvey Cloud
Survey theme/template: Fruity

==================
Hi everybody,
I have an issue with a survey, because the same validation equation and suggestion work in one case and don't in another one.
In the survey there are two arrays, the only difference between them is the last column. Indeed, the first table has a drop-down menu, the second one a checkbox.
The validation equation and suggestion work in the first array and don't in the second one. In particular the warning "Enter unchanged only if prices are the same of the previous week" takes action also when the checkbox isn't checked.
Does someone know where is the problem in the second table? Please find attached the file lss to understand how it works. 

Thank you in advance.
Regards,
Carlotta

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago #232415 by Joffm
Hi, Carlotta,
your validation works - though there are a few unnecessary things (see below).

But your script to add the checkboxes seems to be very strange.
You see there is a part about "exclusive items". But you do not handle "exclusive items" and the class "'.exclusive-item" is nowhere added.

Then the "Returning to page" part.
This is copied from the other script, isn't it.
But here you use a class ".with-select" which is not defined in this script, but in one of the first lines of the other script 
// Insert selects
    $('.answer-item.answer_cell_X005', thisQuestion).addClass(
'with-select').append('<select class="inserted-select form-control list-question-....
where you really insert "selects".

I do not know where you found this script, but because I am absolutely unable to write javascript code myself I can't help.

I found these three scripts.
[url] forums.limesurvey.org/forum/french-forum...ns-un-tableau#231392 [/url]
Remove the part with the "Insert selects" till "Insert checkboxes" drop-down and set the ONE chckbox into the fifth column.

Here is something with "exclusive checkboxes".
[url] forums.limesurvey.org/forum/can-i-do-thi...ith-radiolist#226020 [/url]
Here the two last checkboxes are really exclusive. If checked the rest of the row is emptied.

And this third seems to fulfill your wishes.
[url] forums.limesurvey.org/forum/can-i-do-thi...sive-checkbox#177208 [/url]

Now a word about the validation itself
These two lines (the second and the third part of each subquestion)
(is_empty(Q2_Y001_X004.NAOK) AND is_empty(Q2_Y001_X003.NAOK) AND is_empty(Q2_Y001_X005.NAOK)) OR 
(is_empty(Q2_Y001_X004.NAOK) AND is_empty(Q2_Y001_X003.NAOK) AND !is_empty(Q2_Y001_X005.NAOK) OR ...
So no matter if Q2_Y001_X005 is empty or not and no matter what follows after this second line, this validation is TRUE if X003 and X004 are empty (because of the OR operation)

Joffm
  

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose