- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Comments mandatory for 'Multiple choice with comments'
- Rzwiers
- Topic Author
- Offline
- New Member
Less
More
6 years 9 months ago #156138
by Rzwiers
Comments mandatory for 'Multiple choice with comments' was created by Rzwiers
Hi all,
In Limesurvey I have a couple of multiple choice questions with comments. I would like to make it mandatory to enter a comment before you can thick the box to select a specific answer in the list (just like is possible for 'other'). I hope this is possible.
Thanks so much for you help!
In Limesurvey I have a couple of multiple choice questions with comments. I would like to make it mandatory to enter a comment before you can thick the box to select a specific answer in the list (just like is possible for 'other'). I hope this is possible.
Thanks so much for you help!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
6 years 9 months ago #156154
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Comments mandatory for 'Multiple choice with comments'
You can make comments and corresponding checkboxes mandatory via the Question validation equation.
So, assuming question codes like SQ001, SQ002, SQ003 and SQ004, an equation like this (line-breaks added for clarity):
So, assuming question codes like SQ001, SQ002, SQ003 and SQ004, an equation like this (line-breaks added for clarity):
Code:
{(is_empty(Q1_SQ001) AND is_empty(Q1_SQ001comment)) OR (!is_empty(Q1_SQ001) AND !is_empty(Q1_SQ001comment)) AND (is_empty(Q1_SQ002) AND is_empty(Q1_SQ002comment)) OR (!is_empty(Q1_SQ002) AND !is_empty(Q1_SQ002comment)) AND (is_empty(Q1_SQ003) AND is_empty(Q1_SQ003comment)) OR (!is_empty(Q1_SQ003) AND !is_empty(Q1_SQ003comment)) AND (is_empty(Q1_SQ004) AND is_empty(Q1_SQ004comment)) OR (!is_empty(Q1_SQ004) AND !is_empty(Q1_SQ004comment))}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Rzwiers
The topic has been locked.
- Rzwiers
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
6 years 9 months ago #156159
by Rzwiers
Replied by Rzwiers on topic Comments mandatory for 'Multiple choice with comments'
Thanks a lot for your answer. For some reason I can't get this to work. I entered the code as Question validation equation and changed Q1 to the name of the question. When I save and preview the question, it is still possible to click the checkbox without commenting
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
6 years 9 months ago #156188
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Comments mandatory for 'Multiple choice with comments'
If your adaptations are correct, you may be able to click the checkbox without commenting but you will not be allowed to submit the page. You can add a question validation tip to indicate that.
Sample survey attached:
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- IlanaWilken
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
6 years 5 months ago - 6 years 5 months ago #160210
by IlanaWilken
Replied by IlanaWilken on topic Comments mandatory for 'Multiple choice with comments'
Good day
I had the same issue in figuring this out, so I'm grateful for this post. However, after entering the question validation equation, it doesn't quite work as it should. I have six options, and only the first option's comment is seen as "mandatory". What could the reason for this be? Here is my equation:
Thank you!
I had the same issue in figuring this out, so I'm grateful for this post. However, after entering the question validation equation, it doesn't quite work as it should. I have six options, and only the first option's comment is seen as "mandatory". What could the reason for this be? Here is my equation:
Code:
(is_empty(RI7_SQ001) AND is_empty(RI7_SQ001comment)) OR (!is_empty(RI7_SQ001) AND !is_empty(RI7_SQ001comment)) AND (is_empty(RI7_SQ002) AND is_empty(RI7_SQ002comment)) OR (!is_empty(RI7_SQ002) AND !is_empty(RI7_SQ002comment)) AND (is_empty(RI7_SQ003) AND is_empty(RI7_SQ003comment)) OR (!is_empty(RI7_SQ003) AND !is_empty(RI7_SQ003comment)) AND (is_empty(RI7_SQ004) AND is_empty(RI7_SQ004comment)) OR (!is_empty(RI7_SQ004) AND !is_empty(RI7_SQ004comment)) AND (is_empty(RI7_SQ005) AND is_empty(RI7_SQ005comment)) OR (!is_empty(RI7_SQ005) AND !is_empty(RI7_SQ005comment)) AND (is_empty(RI7_SQ006) AND is_empty(RI7_SQ006comment)) OR (!is_empty(RI7_SQ006) AND !is_empty(RI7_SQ006comment))
Thank you!
Last edit: 6 years 5 months ago by IlanaWilken.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
6 years 5 months ago - 6 years 5 months ago #160212
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Comments mandatory for 'Multiple choice with comments'
Hello, Ilana,
I can not reproduce that.
Are there any other conditions in this question?
See sample
Best regards
Joffm
I can not reproduce that.
Are there any other conditions in this question?
See sample
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 6 years 5 months ago by Joffm.
The topic has been locked.
- IlanaWilken
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
6 years 5 months ago - 6 years 5 months ago #160220
by IlanaWilken
Replied by IlanaWilken on topic Comments mandatory for 'Multiple choice with comments'
Hello Joffm
There aren't any other conditions in this question that I know of. However, I only started using LimeSurvey yesterday, so I might be wrong.
I compared the code in your attachment to mine, and I see a big difference (see mine below). I just, unfortunately, don't know how to get mine to look like yours by just using Lime Survey's interface (I'm not a programmer).
The question is supposed to be mandatory and I thought that might influence it, but I turned it off and it still gave me the same results.
There aren't any other conditions in this question that I know of. However, I only started using LimeSurvey yesterday, so I might be wrong.
I compared the code in your attachment to mine, and I see a big difference (see mine below). I just, unfortunately, don't know how to get mine to look like yours by just using Lime Survey's interface (I'm not a programmer).
The question is supposed to be mandatory and I thought that might influence it, but I turned it off and it still gave me the same results.
Code:
<question_attributes> <fields> <fieldname>qid</fieldname> <fieldname>attribute</fieldname> <fieldname>value</fieldname> <fieldname>language</fieldname> </fields> <rows> <row> <qid><![CDATA[13]]></qid> <attribute><![CDATA[display_rows]]></attribute> <value><![CDATA[5]]></value> </row> <row> <qid><![CDATA[13]]></qid> <attribute><![CDATA[label_input_columns]]></attribute> <value><![CDATA[2]]></value> </row> <row> <qid><![CDATA[13]]></qid> <attribute><![CDATA[max_answers]]></attribute> <value><![CDATA[5]]></value> </row> <row> <qid><![CDATA[13]]></qid> <attribute><![CDATA[min_answers]]></attribute> <value><![CDATA[3]]></value> </row> <row> <qid><![CDATA[13]]></qid> <attribute><![CDATA[text_input_columns]]></attribute> <value><![CDATA[7]]></value> </row> <row> <qid><![CDATA[29]]></qid> <attribute><![CDATA[label_input_columns]]></attribute> <value><![CDATA[2]]></value> </row> <row> <qid><![CDATA[29]]></qid> <attribute><![CDATA[max_answers]]></attribute> <value><![CDATA[10]]></value> </row> <row> <qid><![CDATA[29]]></qid> <attribute><![CDATA[min_answers]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[29]]></qid> <attribute><![CDATA[text_input_columns]]></attribute> <value><![CDATA[7]]></value> </row> <row> <qid><![CDATA[43]]></qid> <attribute><![CDATA[commented_checkbox_auto]]></attribute> <value><![CDATA[0]]></value> </row> <row> <qid><![CDATA[43]]></qid> <attribute><![CDATA[em_validation_q]]></attribute> <value><![CDATA[(is_empty(RI7_SQ001) AND is_empty(RI7_SQ001comment)) OR (!is_empty(RI7_SQ001) AND !is_empty(RI7_SQ001comment)) AND (is_empty(RI7_SQ002) AND is_empty(RI7_SQ002comment)) OR (!is_empty(RI7_SQ002) AND !is_empty(RI7_SQ002comment)) AND (is_empty(RI7_SQ003) AND is_empty(RI7_SQ003comment)) OR (!is_empty(RI7_SQ003) AND !is_empty(RI7_SQ003comment)) AND (is_empty(RI7_SQ004) AND is_empty(RI7_SQ004comment)) OR (!is_empty(RI7_SQ004) AND !is_empty(RI7_SQ004comment)) AND (is_empty(RI7_SQ005) AND is_empty(RI7_SQ005comment)) OR (!is_empty(RI7_SQ005) AND !is_empty(RI7_SQ005comment)) AND (is_empty(RI7_SQ006) AND is_empty(RI7_SQ006comment)) OR (!is_empty(RI7_SQ006) AND !is_empty(RI7_SQ006comment))]]></value> </row> <row> <qid><![CDATA[55]]></qid> <attribute><![CDATA[display_rows]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[55]]></qid> <attribute><![CDATA[label_input_columns]]></attribute> <value><![CDATA[2]]></value> </row> <row> <qid><![CDATA[55]]></qid> <attribute><![CDATA[text_input_columns]]></attribute> <value><![CDATA[7]]></value> </row> <row> <qid><![CDATA[80]]></qid> <attribute><![CDATA[max_num_of_files]]></attribute> <value><![CDATA[20]]></value> </row> <row> <qid><![CDATA[93]]></qid> <attribute><![CDATA[max_num_of_files]]></attribute> <value><![CDATA[20]]></value> </row> <row> <qid><![CDATA[125]]></qid> <attribute><![CDATA[max_num_of_files]]></attribute> <value><![CDATA[20]]></value> </row> <row> <qid><![CDATA[148]]></qid> <attribute><![CDATA[max_num_of_files]]></attribute> <value><![CDATA[20]]></value> </row> <row> <qid><![CDATA[149]]></qid> <attribute><![CDATA[max_num_of_files]]></attribute> <value><![CDATA[20]]></value> </row> <row> <qid><![CDATA[150]]></qid> <attribute><![CDATA[alphasort]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[151]]></qid> <attribute><![CDATA[alphasort]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[152]]></qid> <attribute><![CDATA[alphasort]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[153]]></qid> <attribute><![CDATA[alphasort]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[154]]></qid> <attribute><![CDATA[alphasort]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[175]]></qid> <attribute><![CDATA[display_rows]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[175]]></qid> <attribute><![CDATA[label_input_columns]]></attribute> <value><![CDATA[2]]></value> </row> <row> <qid><![CDATA[175]]></qid> <attribute><![CDATA[text_input_columns]]></attribute> <value><![CDATA[7]]></value> </row> <row> <qid><![CDATA[186]]></qid> <attribute><![CDATA[display_rows]]></attribute> <value><![CDATA[1]]></value> </row> <row> <qid><![CDATA[186]]></qid> <attribute><![CDATA[label_input_columns]]></attribute> <value><![CDATA[2]]></value> </row> <row> <qid><![CDATA[186]]></qid> <attribute><![CDATA[text_input_columns]]></attribute> <value><![CDATA[7]]></value> </row> </rows> </question_attributes>
Last edit: 6 years 5 months ago by IlanaWilken.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
6 years 5 months ago #160221
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Comments mandatory for 'Multiple choice with comments'
Hi,Ilana,
I sent you an *.lss file.
So just import this survey and compare.
manual.limesurvey.org/Surveys_-_introduction#Import_a_survey
Best regards
Joffm
I sent you an *.lss file.
So just import this survey and compare.
manual.limesurvey.org/Surveys_-_introduction#Import_a_survey
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- IlanaWilken
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
6 years 5 months ago #160223
by IlanaWilken
Replied by IlanaWilken on topic Comments mandatory for 'Multiple choice with comments'
Hi
I just imported your survey and compared. Everything is now the same as yours.
I did a preview of your survey and unfortunately, the same thing happens. Only the first multiple choice choice is required to have a comment. The others can just be ticked and it's accepted like that. I will test and play around and hopefully come to a solution. If not, it won't be the end of the world.
Thanks again for your help.
Ilana
I just imported your survey and compared. Everything is now the same as yours.
I did a preview of your survey and unfortunately, the same thing happens. Only the first multiple choice choice is required to have a comment. The others can just be ticked and it's accepted like that. I will test and play around and hopefully come to a solution. If not, it won't be the end of the world.
Thanks again for your help.
Ilana
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
6 years 5 months ago #160225
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Comments mandatory for 'Multiple choice with comments'
Well, then you'd send us YOUR survey (*.lss) or a part of it with this question.
Best regards
Joffm
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- annieandongmei
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
6 years 2 weeks ago #166522
by annieandongmei
annie
Replied by annieandongmei on topic Comments mandatory for 'Multiple choice with comments'
Hi, I am having the same issue. Attached is my survy. Can you help me?
annie
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
6 years 2 weeks ago - 6 years 2 weeks ago #166533
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Comments mandatory for 'Multiple choice with comments'
You were missing some brackets.
Here is a sample survey:
Code:
((is_empty(Q00004_SQ001) AND is_empty(Q00004_SQ001comment)) OR (! is_empty(Q00004_SQ001) AND ! is_empty(Q00004_SQ001comment))) AND ((is_empty(Q00004_SQ002) AND is_empty(Q00004_SQ002comment)) OR (! is_empty(Q00004_SQ002) AND ! is_empty(Q00004_SQ002comment))) AND ((is_empty(Q00004_SQ003) AND is_empty(Q00004_SQ003comment)) OR (! is_empty(Q00004_SQ003) AND ! is_empty(Q00004_SQ003comment))) AND ((is_empty(Q00004_SQ004) AND is_empty(Q00004_SQ004comment)) OR (! is_empty(Q00004_SQ004) AND ! is_empty(Q00004_SQ004comment))) AND ((is_empty(Q00004_SQ005) AND is_empty(Q00004_SQ005comment)) OR (! is_empty(Q00004_SQ005) AND ! is_empty(Q00004_SQ005comment))) AND ((is_empty(Q00004_SQ006) AND is_empty(Q00004_SQ006comment)) OR (! is_empty(Q00004_SQ006) AND ! is_empty(Q00004_SQ006comment))) AND ((is_empty(Q00004_SQ007) AND is_empty(Q00004_SQ007comment)) OR (! is_empty(Q00004_SQ007) AND ! is_empty(Q00004_SQ007comment))) AND ((is_empty(Q00004_SQ008) AND is_empty(Q00004_SQ008comment)) OR (! is_empty(Q00004_SQ008) AND ! is_empty(Q00004_SQ008comment)))
Here is a sample survey:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 6 years 2 weeks ago by tpartner.
The topic has been locked.