- Posts: 6
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript"> $(document).ready(function() { function validateVanWestendorp() { var answer1 = parseFloat($('input[name="questioncode_SQ001"]').val()); var answer2 = parseFloat($('input[name="questioncode_SQ002"]').val()); var answer3 = parseFloat($('input[name="questioncode_SQ003"]').val()); var answer4 = parseFloat($('input[name="questioncode_SQ004"]').val()); if (isNaN(answer1) || isNaN(answer2) || isNaN(answer3) || isNaN(answer4)) { return false; // Ensure all inputs are filled } if (answer1 > answer2 &amp;&amp; answer2 > answer3 &amp;&amp; answer3 > answer4) { return true; } else { alert('Bitte stellen Sie sicher, dass Antwort 1 > Antwort 2 > Antwort 3 > Antwort 4 ist.'); return false; } } $('input[name="questioncode_SQ001"], input[name="questioncode_SQ002"], input[name="questioncode_SQ003"], input[name="questioncode_SQ004"]').on('blur', function() { validateVanWestendorp(); }); $('#movenextbtn').click(function(event) { if (!validateVanWestendorp()) { event.preventDefault(); } }); }); </script>