- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Automatically check box if people provide a comment in a 'mc question'
- psk123
- Topic Author
- Offline
- New Member
Less
More
7 years 3 weeks ago #152014
by psk123
Automatically check box if people provide a comment in a 'mc question' was created by psk123
Dear Limesurvey users,
Using the question type 'mc question with comments', I would like that Limesurvey automatically ticks / checks the box if respondents leave a comment.
* Example *
Q1: What is your favorite animal?
[] Dog
[] Cat
[] Other, specify ____
=======
When respondents start writing something after specify (eg., 'bird'), the box before 'Other', needs to be ticked automatically.
======
[x] Other, specify bird
======
Thank you!
Using the question type 'mc question with comments', I would like that Limesurvey automatically ticks / checks the box if respondents leave a comment.
* Example *
Q1: What is your favorite animal?
[] Dog
[] Cat
[] Other, specify ____
=======
When respondents start writing something after specify (eg., 'bird'), the box before 'Other', needs to be ticked automatically.
======
[x] Other, specify bird
======
Thank you!
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
7 years 3 weeks ago #152018
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Automatically check box if people provide a comment in a 'mc question'
If your case is just to add ONE other, as you describe, I would rather use "multiple choice" and activate the other option, because there the behaviour is how you wish. As soon as you write something in the other text box, the checkbox is automatically ticked by Limesurvey.
Of course this version does not work if you need more than one comment box. But for your example given, this is actually the correct question type and setting.
For the multipe choice with comments you need to first tick the checkbox and then write the comment, otherwise you will receive an error message. There you would have to create a workaround with Javascript or something.
Of course this version does not work if you need more than one comment box. But for your example given, this is actually the correct question type and setting.
For the multipe choice with comments you need to first tick the checkbox and then write the comment, otherwise you will receive an error message. There you would have to create a workaround with Javascript or something.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- psk123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 2 weeks ago #152118
by psk123
Replied by psk123 on topic Automatically check box if people provide a comment in a 'mc question'
Dear Holch,
Thank you for your answer.
No, respondents may select multiple answers. Thus, a specific respondent may select:
=========
* Example *
Q1: What is your favorite animal?
[X] Dog
[] Cat
[X] Other, specify bird
[X] Other, specify snake
=========
Can you give a Javascript hint?
Thank you.
Thank you for your answer.
No, respondents may select multiple answers. Thus, a specific respondent may select:
=========
* Example *
Q1: What is your favorite animal?
[X] Dog
[] Cat
[X] Other, specify bird
[X] Other, specify snake
=========
Can you give a Javascript hint?
Thank you.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2738
7 years 2 weeks ago #152137
by holch
No, not a Javascript expert.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Automatically check box if people provide a comment in a 'mc question'
Can you give a Javascript hint?
No, not a Javascript expert.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- psk123
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 2 weeks ago #152139
by psk123
Replied by psk123 on topic Automatically check box if people provide a comment in a 'mc question'
Hi all,
Thanks to my ICT-buddy
======
Thanks to my ICT-buddy
======
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = 769; var questionInput = '#question'+qID+' input[type="text"]'; $('.comment-container input[type="text"]').keypress(function() { var name = $(this).attr('name'); var selectName = name.replace('comment', '') ; var selectName2 = '#answer' + selectName; var el = $.find(selectName2); $(el).prop('checked', true); }); $(questionInput).autocomplete({ minLength: 2, source: ["Test1","Test2","Test3"] }); }); </script>
The topic has been locked.