Hi all,
thanks to @tpartner for the work and reworks of the script!
I also see your point @Joffm - in the case of a single Y/N I think an error message could suffice.
In my case I have long arrays with lots of statements and agree/disagree scales.
To make answering easier and not frighten my respondents seeing all the lines at once, I would show the array linewise and therefore use subquestion relevance and only show the n+1-th question when the n-th question was answered, etc. This works great with
Question: q1
Subquestions:
sq1 sq_relevance: empty
sq2 sq_relevance: !is_empty(q1_sq1)
sq3 sq_relevance: !is_empty(q1_sq2)
etc.
But: I do not want the "Next" Button to be hidden until the last question of the array was answered. When it unhides/appears it's clear to the respondents that they can continue.
My question is, how your script below (I use LS 2.06LTS) can be reworked to be used for that, i.e. to hide the "Next" Button until the last question of the array was answered (no matter how many questions there are in this array).
Thanks a lot for your help on this!
Best, G
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>