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
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167295 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?

Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago - 5 years 11 months ago #167299 by Joffm
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

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 11 months ago by Joffm.
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167301 by vadikcoma
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:
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167302 by vadikcoma
Ah, I see my mistake. Not fully applied all rules. Will fix
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167303 by vadikcoma
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))
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167305 by Joffm
Hi,
1. Where is your sample survey?

2. Here is mine.

File Attachment:

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


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167306 by vadikcoma
Please try this link - radioeksperti.lv/index.php/321988

Currently I have 2 first hours set

Attachments:
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167307 by vadikcoma
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
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167308 by Joffm
Yes, what you did, was the subquestion relevance.
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
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167312 by Joffm
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:
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
The topic has been locked.
  • vadikcoma
  • vadikcoma's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #167313 by vadikcoma
Thanks Joffm for your help, I will continue working on the form
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167323 by tpartner
For a better respondent experience, you can use an adaptation of this workaround - manual.limesurvey.org/Workarounds:_Manip..._Excludes_All_Others .

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:

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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose