Disable checkboxes in a row, if first checkbox is selected

More
1 month 1 week ago #167295 by vadikcoma
vadikcoma created the topic: Disable checkboxes in a row, if first checkbox is selected
Hello guys, we are running survey about radio stations, and one of our questions is

"please select time of the day, when you were listening to certain station yesterday"


and we give following answer options:

- I wasn't listening to this radio yesterday
- 6:00
- 7:00
- 8:00
..

How do I make sure, that if a person selects first option (wasn't listening) then he is not able to select any hours for this station?

Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #167299 by Joffm
Joffm replied the topic: Disable checkboxes in a row, if first checkbox is selected
Hi,
the easiest way - out of the box - is the validation.
Something like:
((self.sq_SQ001_0!=1) or (sum(self.sq_SQ001)==1)) and ...
with SQ001, SQ002,... as subquestions
and "0" of code of option "not listening"


1. Correct


2. Not correct


Best regards
Joffm
Attachments:
Last Edit: 1 month 1 week ago by Joffm.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167301 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Hello Joffm,

Thank you for your time and reply,

I've tried your valiadation, however it still allows me to check multiple boxes when "wasn't listening" is checked. I will attach screenshot

Validation equation - ((self.sq_SQ019_0!=1) or (count(self.sq_SQ019)==1))

Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167302 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Ah, I see my mistake. Not fully applied all rules. Will fix

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167303 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Joffm,

I'm really sorry, but I'm still not getting it. I've tried all possible combinations, and it still allows to check multiple

I have SQ019 for this question

((self.sq_SQ019_0!=1) or (count(self.sq_SQ019)==1))
((self.sq_SQ019_0!=0) or (count(self.sq_SQ019)==0))

((self.sq_SQ019_0!=1)
((self.sq_SQ019_0!=0)

(count(self.sq_SQ019)==1))
(count(self.sq_SQ019)==0))

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167305 by Joffm
Joffm replied the topic: Disable checkboxes in a row, if first checkbox is selected
Hi,
1. Where is your sample survey?

2. Here is mine.

File Attachment:

File Name: limesurvey...9315.lss
File Size:21 KB


Joffm
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167306 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Please try this link - radioeksperti.lv/index.php/321988

Currently I have 2 first hours set

Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167307 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Ah, I see difference - you've set your validation for whole survey, I did for each cell. I will try your approach it seems to work

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167308 by Joffm
Joffm replied the topic: Disable checkboxes in a row, if first checkbox is selected
Yes, what you did, was the subquestion relevance.
This is quite different from validation.

Joffm

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167312 by Joffm
Joffm replied the topic: Disable checkboxes in a row, if first checkbox is selected
Hi,
furthermore you could mark this special cell.


I saw that your template was a ubuntu orange, though you unfortunately didn't tell us your LS version.

Well, add this to the question text:
<style type="text/css">
.answer_cell_000,
.answer_cell_0
{
    background-color: #eee !important;
    border-left: 1px solid red !important;
    border-right: 1px solid red !important;
}
</style>

Of course you can play around with the colors.

"000" and "0" are the code of this answer option.

Regards
Joffm
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167313 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Thanks Joffm for your help, I will continue working on the form

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167323 by tpartner
tpartner replied the topic: Disable checkboxes in a row, if first checkbox is selected
For a better respondent experience, you can use an adaptation of this workaround - manual.limesurvey.org/Workarounds:_Manip..._Excludes_All_Others .

Change this line:
$('.normal-item:last', this).removeClass('normal-item').addClass('exlusive-item')

To this:
$('.normal-item:first', this).removeClass('normal-item').addClass('exlusive-item')

Sample survey attached:

File Attachment:

File Name: limesurvey...3693.lss
File Size:21 KB

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

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167332 by vadikcoma
vadikcoma replied the topic: Disable checkboxes in a row, if first checkbox is selected
Thank you very much guys for your help! I really appreciate it.

I've came across (hopefully) last problem.

I have "array" type question, and I need people to select exactly 4 answers.

Question translates to following - "Please select priority in which you would prefer to listen to following radio stations". And they select "1st priority", 2nd, and so on un to fourth.

However this question automatically adds last field which is "no answer". And the problem is - I need to be able to select multiple options in "No answer". As we have 13 stations and we ask to rank only top-4. So 9 stations should stay as "No answer"

As soon as I select any other option in "no answer" manually - everything breaks. Please see screenshot:

link - radioeksperti.lv/index.php/743247



When I select my 4 options - all seems nice and cool:



But if I make a mistake and want to select another station, this happens:



And there is no way I can select multiple "no answer" from this point onwards.

Maybe you have some ideas how to improve this?
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167333 by tpartner
tpartner replied the topic: Disable checkboxes in a row, if first checkbox is selected
That workaround was not intended to work with no answer enabled. Disable that in your survey settings and insert it manually in the questions where you need it.

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

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167334 by Joffm
Joffm replied the topic: Disable checkboxes in a row, if first checkbox is selected

I have "array" type question, and I need people to select exactly 4 answers.

Question translates to following - "Please select priority in which you would prefer to listen to following radio stations". And they select "1st priority", 2nd, and so on un to fourth.


So this is a ranking question and you should use a question of this type.
Just set "Maximum answers" to 4.





Joffm
Attachments:

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!