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

More
7 years 4 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?

The topic has been locked.
More
7 years 4 months ago - 7 years 4 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: 7 years 4 months ago by Joffm.
The topic has been locked.
More
7 years 4 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))

The topic has been locked.
More
7 years 4 months ago #167302 by vadikcoma
Ah, I see my mistake. Not fully applied all rules. Will fix
The topic has been locked.
More
7 years 4 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.
More
7 years 4 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.11 KB


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
7 years 4 months ago #167306 by vadikcoma
Please try this link - radioeksperti.lv/index.php/321988

Currently I have 2 first hours set

The topic has been locked.
More
7 years 4 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.
More
7 years 4 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.
More
7 years 4 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.
More
7 years 4 months ago #167313 by vadikcoma
Thanks Joffm for your help, I will continue working on the form
The topic has been locked.
More
7 years 4 months ago #167323 by tpartner
For a better respondent experience, you can use an adaptation of this workaround - www.limesurvey.org/manual/Workarounds:_M..._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:20.52 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.
More
7 years 4 months ago #167332 by vadikcoma
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?
More
7 years 4 months ago #167333 by tpartner
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.
The topic has been locked.
More
7 years 4 months ago #167334 by Joffm

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

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

Lime-years ahead

Online-surveys for every purse and purpose