- Posts: 33
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Disable checkboxes in a row, if first checkbox is selected
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
5 years 11 months ago #167295
by vadikcoma
Disable checkboxes in a row, if first checkbox is selected was created by vadikcoma
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?
"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:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
5 years 11 months ago - 5 years 11 months ago #167299
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 5 years 11 months ago by Joffm.
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167301
by vadikcoma
Replied by vadikcoma on topic Disable checkboxes in a row, if first checkbox is selected
Attachments:
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167302
by vadikcoma
Replied by vadikcoma on topic Disable checkboxes in a row, if first checkbox is selected
Ah, I see my mistake. Not fully applied all rules. Will fix
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167303
by vadikcoma
Replied by vadikcoma on 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))
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))
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
5 years 11 months ago #167305
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Disable checkboxes in a row, if first checkbox is selected
Hi,
1. Where is your sample survey?
2. Here is mine.
Joffm
1. Where is your sample survey?
2. Here is mine.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167306
by vadikcoma
Replied by vadikcoma on topic Disable checkboxes in a row, if first checkbox is selected
Attachments:
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167307
by vadikcoma
Replied by vadikcoma on 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
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
5 years 11 months ago #167308
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
This is quite different from validation.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
5 years 11 months ago #167312
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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:
Of course you can play around with the colors.
"000" and "0" are the code of this answer option.
Regards
Joffm
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:
Code:
<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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- vadikcoma
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
5 years 11 months ago #167313
by vadikcoma
Replied by vadikcoma on topic Disable checkboxes in a row, if first checkbox is selected
Thanks Joffm for your help, I will continue working on the form
The topic has been locked.
- tpartner
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
5 years 11 months ago #167323
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 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:
To this:
Sample survey attached:
Change this line:
Code:
$('.normal-item:last', this).removeClass('normal-item').addClass('exlusive-item')
To this:
Code:
$('.normal-item:first', this).removeClass('normal-item').addClass('exlusive-item')
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.