- Posts: 153
- Thank you received: 8
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
add button in a popup for mandatory questions
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
7 years 2 months ago - 7 years 2 months ago #147675
by KompetenzZ
Cheers kompetenzz
add button in a popup for mandatory questions was created by KompetenzZ
Hello,
I would like to use a the setting "Mandatory: On" and adding a button into the popup notification when the mandatory question has not been answered. See the picture in the attachment
Thank you in advance
I would like to use a the setting "Mandatory: On" and adding a button into the popup notification when the mandatory question has not been answered. See the picture in the attachment
Thank you in advance
Cheers kompetenzz
Attachments:
Last edit: 7 years 2 months ago by KompetenzZ.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 2 months ago #147684
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 add button in a popup for mandatory questions
You won't be able to do that if using the "mandatory" setting because there is no way to advance the survey without answering the question(s).
With non-mandatory questions you could insert a script to interrupt the "Next" button action, detect if certain questions are unanswered and, if so, pop up a modal asking whether you are sure you want to continue.
The details of that script would vary depending on the question types.
With non-mandatory questions you could insert a script to interrupt the "Next" button action, detect if certain questions are unanswered and, if so, pop up a modal asking whether you are sure you want to continue.
The details of that script would vary depending on the question types.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 2 months ago #147729
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 add button in a popup for mandatory questions
Alternative solution :
framagit.org/SondagePro-LimeSurvey-plugin/checkboxForText
This add a checkbox for 'text' question type with 'I don't want to answer' (for example) . Tested and working on 2.55 and up.
Denis
This add a checkbox for 'text' question type with 'I don't want to answer' (for example) . Tested and working on 2.55 and up.
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.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
7 years 2 months ago #147817
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on topic add button in a popup for mandatory questions
I would like to add this "Proceed anyway button" to the following question types (see attachment):
Thank you
- Multiple choice
- List (radio)
- Numerical input
Thank you
Cheers kompetenzz
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 2 months ago #147825
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 add button in a popup for mandatory questions
I obviously can't give examples for all combinations of questions but the following example will test to see if all questions have been answered in a group containing:
- a single multiple-choice
- a single list-radio
- a single numeric
Set up your survey to use JavaScript and place a script like this in the source of one of the questions:
Sample survey attached:
- a single multiple-choice
- a single list-radio
- a single numeric
Set up your survey to use JavaScript and place a script like this in the source of one of the questions:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Insert the modal elements $('body').append('<div id="submit-alert" class="modal fade">\ <div class="modal-dialog">\ <div class="modal-content">\ <div class="modal-header" style="min-height:40px;">\ <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">&times;</button>\ <h4 class="modal-title"></h4>\ </div>\ <div class="modal-body">\ <p>You have not answered all questions!</p>\ </div>\ <div class="modal-footer">\ <a href="#" class="btn btn-default proceed">Proceed Anyway</a>\ <a href="#" data-bs-dismiss="modal" class="btn btn-default">Close</a>\ </div>\ </div>\ </div>\ </div>'); // Listener on the modal "Proceed" button $('#submit-alert a.proceed').on('click', function(e) { e.preventDefault(); $('#movenextbtn').prop('disabled', false).removeClass('disabled active').trigger('click'); }); // Listener on the "Next" button $('#movenextbtn').on('click', function(e) { // Conditions when to show the modal pop-up // In this example, show the modal IF: // The modal pop-up is not currently shown // AND // ( // Q1 (multi-choice) has less than one checked item // OR // Q2 (list-radio) is unanswered // OR // Q3 (numeric) is unanswered // ) if(!$('#submit-alert').is(':visible') && ($('.multiple-opt:eq(0) input[type="checkbox"]:checked').length == 0 || $('.list-radio:eq(0) input[type="radio"]:checked').length == 0 || $('.numeric:eq(0) input[type="text"]:eq(0)').val() == '')) { e.preventDefault(); $('#submit-alert').modal('show'); } $('#movenextbtn').prop('disabled', false).removeClass('disabled active'); }); }); </script>
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.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 2 months ago #147831
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic add button in a popup for mandatory questions
We had this requesting answers vs. enforcing answers before.
www.limesurvey.org/forum/can-i-do-this-w...r-which-you-can-skip
I have opened a feature request for this kind of behavior.
bugs.limesurvey.org/view.php?id=12088
www.limesurvey.org/forum/can-i-do-this-w...r-which-you-can-skip
I have opened a feature request for this kind of behavior.
bugs.limesurvey.org/view.php?id=12088
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 2 months ago #147832
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 add button in a popup for mandatory questions
Yup, but please note that the workaround in your first link is for 2.06 and probably won't work in 2.5x without modification.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 2 months ago #147837
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic add button in a popup for mandatory questions
Yepp, still on 2.6.X Let's see if 3.X will bring a consolidation. Not sure if we can allow you to provide workarounds for three flavors of LS.tpartner wrote: Yup, but please note that the workaround in your first link is for 2.06 and probably won't work in 2.5x without modification.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 2 months ago #147838
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 add button in a popup for mandatory questions
I'll just have to increase my fees
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
7 years 2 months ago #147842
by holch
As long as it is a multiplication of the current fees I think it is totally fine...
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 add button in a popup for mandatory questions
tpartner wrote: I'll just have to increase my fees
As long as it is a multiplication of the current fees I think it is totally fine...
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.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 2 months ago #147864
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 add button in a popup for mandatory questions
Hi ,
I really think it's a misconcept to allow some question to be non mandatory if we click on a button.
I think the concept MUST be :
- Add a way to choose 'I don't want to answer' anywhere, i wrote NA after
Here : there are currently multiple solution
-> single choice : just add one Answer NA
-> multiple choice : Add a NA exlusivle option
-> Array : Add a NA answer (each line)
No , the 'hardest'
=> Any question (whole part), code (for the example) : CODE
-> Add a multiple choice after the question CODENA, with only one subquestion NA
-> Add relevance/equation/condition on the first question : CODENA_NA
=> Specific to single text and multiple text
-> Usage of framagit.org/SondagePro-LimeSurvey-plugin/checkboxForText
For this plugin : i must fork it and doing a plugin using only Question advanced settings, but it work, really work. I update it in 3.0 because seems to be easiest to add HTML in answers (unsure on this part ....)
I really think it's a misconcept to allow some question to be non mandatory if we click on a button.
I think the concept MUST be :
- Add a way to choose 'I don't want to answer' anywhere, i wrote NA after
Here : there are currently multiple solution
-> single choice : just add one Answer NA
-> multiple choice : Add a NA exlusivle option
-> Array : Add a NA answer (each line)
No , the 'hardest'
=> Any question (whole part), code (for the example) : CODE
-> Add a multiple choice after the question CODENA, with only one subquestion NA
-> Add relevance/equation/condition on the first question : CODENA_NA
=> Specific to single text and multiple text
-> Usage of framagit.org/SondagePro-LimeSurvey-plugin/checkboxForText
For this plugin : i must fork it and doing a plugin using only Question advanced settings, but it work, really work. I update it in 3.0 because seems to be easiest to add HTML in answers (unsure on this part ....)
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.