Since the inclusion of Expression Manager we need to have a space or line-break after all opening curly braces and before all closing curly braces. (don't get me started on the whole "valid JavaScript" discussion again)
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){var q1ID =68;var msg ='Please specify in the comment box.';// Hide the first 3 text inputs of Q1
$('#question'+q1ID+' li[id^="javatbd"]:eq(0) .comment').hide();
$('#question'+q1ID+' li[id^="javatbd"]:eq(1) .comment').hide();
$('#question'+q1ID+' li[id^="javatbd"]:eq(2) .comment').hide();// Interrupt next/submit function
$('#movenextbtn, #movesubmitbtn').click(function(){// Reset some stuffvar failedMandatory =0;
$('#question'+q1ID+' input.text').css({'background':''});// Loop through all check answers in Q1
$('#question'+q1ID+' input.checkbox:checked').each(function(i){// Define the rowvar thisRow = $(this).parents('li:eq(0)');// Check for empty mandatory text inputsif($('input.text:visible', thisRow).length >0&& $('input.text', thisRow).val()==''){
$('input.text', thisRow).css({'background':'pink'});
failedMandatory =1;}});// Abort submit if any mandatory text inputs are emptyif(failedMandatory ==1){
alert (msg);returnfalse;}else{returntrue;}});});</script>
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Thank you very much for your help. It works brilliantly, I spent a lot of time looking for solutions but apparently missed out on the basics of writing the scripts within a question. Now that I have gotten past this hurdle I think it would be wise to spend time learning the basics.
Again thank you very much for your help. This was my first attempt to use LimeSurvey and it seems like it is a great tool for creating online surveys with a wonderfully helpful community.