- Posts: 12
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to make the comment mandatory?
- Perry
- Topic Author
- Offline
- New Member
Less
More
8 years 6 months ago #127241
by Perry
How to make the comment mandatory? was created by Perry
The question type is "list with comment"
After set mandatory in question, still can't force the participant to fill comment field.
Any solutions?
After set mandatory in question, still can't force the participant to fill comment field.
Any solutions?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
8 years 6 months ago #127245
by DenisChenu
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.
Replied by DenisChenu on topic How to make the comment mandatory?
Hi,
In the last version : you have "Question validation equation". If your question code is QCODE : put !is_empty(QCODE_comment) in this setting.
In the last version : you have "Question validation equation". If your question code is QCODE : put !is_empty(QCODE_comment) in this setting.
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.
- Perry
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 1
8 years 6 months ago - 8 years 6 months ago #127247
by Perry
Replied by Perry on topic How to make the comment mandatory?
Awesome!!! Thanks a lot!
Could you send me you BTC or BTS account?
Added the expression like this [!is_empty(Q2a_comment) or (Q2a.NAOK == "1") or (Q2a.NAOK == "2")]
It looks well.
Final style like this: the mandatory comment shows when chosen NAOK3 or NAOK4, while the comment will auto hided and non-mandatory when chosen NAOK1 or NAOK2.
//When I use "!is_empty(Q2a_comment)", it worked.
//However it's failed when expression is [if((Q2a.NAOK == "3" or Q2a.NAOK == "4"),!is_empty(Q2a_comment),"")]
//I want the mandatory comment shows when chosen NAOK3 or NAOK4, while the comment will auto hided and non-mandatory when chosen //NAOK1 or NAOK2.
//Hereafter is the auto hided code:
Could you send me you BTC or BTS account?
Added the expression like this [!is_empty(Q2a_comment) or (Q2a.NAOK == "1") or (Q2a.NAOK == "2")]
It looks well.
Final style like this: the mandatory comment shows when chosen NAOK3 or NAOK4, while the comment will auto hided and non-mandatory when chosen NAOK1 or NAOK2.
//When I use "!is_empty(Q2a_comment)", it worked.
//However it's failed when expression is [if((Q2a.NAOK == "3" or Q2a.NAOK == "4"),!is_empty(Q2a_comment),"")]
//I want the mandatory comment shows when chosen NAOK3 or NAOK4, while the comment will auto hided and non-mandatory when chosen //NAOK1 or NAOK2.
//Hereafter is the auto hided code:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var thisQuestion = $('#question{QID}'); // start listener $('input.radio', thisQuestion).on('click', function(e) { if($(this).attr('value') >2 ) { $('p.answer-item',thisQuestion).show(); } else { $('p.answer-item',thisQuestion).hide(); } }); }); </script> .
Last edit: 8 years 6 months ago by Perry.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
8 years 6 months ago #127248
by DenisChenu
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.
Replied by DenisChenu on topic How to make the comment mandatory?
The comment hide/shown can not be done using Expression.
But here : the expression must be:
But here : the expression must be:
Code:
(Q2a.NAOK>2 AND !is_empty(Q2a_comment.NAOK)) OR (Q2a.NAOK<=2 AND is_empty(Q2a_comment.NAOK))
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.
- Perry
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 1
8 years 6 months ago - 8 years 6 months ago #127249
by Perry
Replied by Perry on topic How to make the comment mandatory?
Sure, I used the expression like [!is_empty(Q2a_comment) or (Q2a.NAOK == "1") or (Q2a.NAOK == "2")]
And it worked!
Besides I pasted the JS script to show/hide comment in above posts.
Thanks a lot for your kindly and rapid answer.
Send your BTC or BTS account to me , please.
And it worked!
Besides I pasted the JS script to show/hide comment in above posts.
Thanks a lot for your kindly and rapid answer.
Send your BTC or BTS account to me , please.
Last edit: 8 years 6 months ago by Perry.
The topic has been locked.