Multiple choice with comments

More
3 years 10 months ago #96214 by benmok
Hi - I am trying to make the comment box in a multiple choice with comment question only appear for those that the respondents have selected.

Also is there a way to make the comment box mandatory?

Thanks in advance.
Ben
Attachments:

Please Log in to join the conversation.

More
3 years 10 months ago #96225 by DenisChenu
You have to play with javascript.

Somethink like that:

$("#question{QID} input.checkbox").click(function(){
if ($(this).prop('checked')){
$(this).closest(".answer-item").find(".comment").show();
}else{
$(this).closest(".answer-item").find(".comment").hide();
}
});

Not tested or validated, please adapt.

For second question: www.limesurvey.org/en/forum/design-issue...quired-comment#96222

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
3 years 10 months ago #96263 by benmok
Hi Denis,

I have not been able to get the javascript to work. Are you able to help?
Actually i have no idea what in the script to change.

I have tried your QCODE_SQ1comment function for the validation script and it didn't work. I am not sure if i got the syntax correct or not. Sorry i know very little of java script and am in the deep water.
This is the syntax i used.
(!is_empty(Reason_1) and is_empty(Reason_1comment))

Thanks,
Ben

Please Log in to join the conversation.

More
3 years 10 months ago #96268 by DenisChenu
I never test javascript and EM for forum.
Give the idea and the principle.

Xhat error do you have ? Can you provide link to test and screenshot of "Expression Manager validation" ?

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.