- Posts: 2
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
tpartner wrote: LS 2.06 uses a newer version of jQuery so try this in the source of the Yes/No question:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); // Listeners on Yes/No radios to toggle the Next/Submit button $('input.radio[value="Y"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', '').removeClass('ui-state-disabled'); }); $('input.radio[value="N"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); // Listeners on Yes/No radios to toggle the Next/Submit button $('input.radio[value="Y"], label[id$="X{QID}Y"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', '').removeClass('ui-state-disabled'); }); $('input.radio[value="N"], label[id$="X{QID}N"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Initially disable the Next/Submit button if($(thisQuestion).is(':visible')) { $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); } // Listeners on Yes/No radios to toggle the Next/Submit button $('input.radio[value="Y"], label[id$="X{QID}Y"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', '').removeClass('ui-state-disabled'); }); $('input.radio[value="N"], label[id$="X{QID}N"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); // Listeners on Yes/No radios to toggle the Next/Submit button $('input.radio[value="Y"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', '').removeClass('ui-state-disabled'); }); $('input.radio[value="N"]', thisQuestion).click(function(){ $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify this question var thisQuestion = $('#question{QID}'); // Initially disable the Next/Submit button $('#movenextbtn, #movesubmitbtn').prop('disabled', 'true').addClass('ui-state-disabled'); // Listeners on radios to enable the Next/Submit button $('input.radio', thisQuestion).click(function(){ if($('input.radio:checked', thisQuestion).length == $('tr.answers-list', thisQuestion).length) { $('#movenextbtn, #movesubmitbtn').prop('disabled', '').removeClass('ui-state-disabled'); } }); }); </script>