Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Multiple choice with comments

  • benmok
  • benmok's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 10 months ago #96214 by benmok
Multiple choice with comments was created 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
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago #96225 by DenisChenu
Replied by DenisChenu on topic Multiple choice with comments
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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • benmok
  • benmok's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 10 months ago #96263 by benmok
Replied by benmok on topic Multiple choice with comments
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
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago #96268 by DenisChenu
Replied by DenisChenu on topic Multiple choice with comments
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 , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose