- Posts: 33
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
tpartner wrote: You should also be able to load a hidden Equation type question using your "flag" equation.
if(flag >= 1, flag, [your equation])
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify some stuff var qHiddenID = {QID}; var qHidden = $('#question'+qHiddenID); var q1 = $('div.numeric:eq(0)'); // First numeric on the page var q2 = $('div.numeric:eq(1)'); // Second numeric on the page // Hide this question $(qHidden).hide(); // Interrupt the Next/Submit function and validate each column $('form#limesurvey').submit(function(){ // Override the built-in "disable navigation buttons" feature $('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', ''); // Q2 value is greater than Q1 value if ($('input.text', q2).val() > $('input.text', q1).val()) { // Populate the hidden question $('input.text', qHidden).val('1'); // Pop up a confirm message if(confirm('Are you sure of your answer?')) { return true; } else { return false; } } }); }); </script>