There is no Question Validation Equation for list-radio questions so you need to use one or both of the following workarounds (similar to
this post
):
- Insert JavaScript to disable the Next/Submit button if Q1 < Q2
- Insert a short-text question after the radio questions with a Question Validation Equation something like:
Code:
intval(Q1) >= intval(Q2)
I have added both workarounds to your sample survey (attached below) as follows...
1) Added the following script to Q1 to disable the Next/Submit button if Q1 < Q2:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:complete',function() {
// Listener on radios
var questions = $('.list-radio:lt(2)');
var q1 = $('.list-radio:eq(0)');
var q2 = $('.list-radio:eq(1)');
$('input[type="radio"]', questions).on('change', function(e) {
var q1Answer = Number($('input[type="radio"]:checked', q1).val());
var q2Answer = Number($('input[type="radio"]:checked', q2).val());
if($('input[type="radio"]:checked', questions).length == 2 && q1Answer < q2Answer) {
$('#movenextbtn, #movesubmitbtn').prop('disabled', true);
}
else {
$('#movenextbtn, #movesubmitbtn').prop('disabled', false);
}
});
});
</script>
2) Inserted a short-text question after the radio questions with the following features:
- Relevance:
Code:
(!is_empty(Q1) AND !is_empty(Q2)) AND intval(Q1) < intval(Q2)
- Question Validation Equation:
Code:
intval(Q1) >= intval(Q2)
- Question Validation Tip: Q2 must be less than or equal to Q1.
- Inserted script to hide the answer element and style the text elements:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:complete',function() {
// Clean up the question appearance
$('#question{QID} .answer-container').remove();
$('#question{QID} .question-title-container').css('padding', '0');
$('#question{QID} .questionvalidcontainer').css('padding', '1em');
});
</script>
Survey attached: