diff --git a/mod/survey/survey.js b/mod/survey/survey.js new file mode 100644 index 00000000000..fba33b56984 --- /dev/null +++ b/mod/survey/survey.js @@ -0,0 +1,26 @@ +function checkform(e) { + var error = false; + if (document.getElementById('surveyform')) { + var surveyform = document.getElementById('surveyform'); + for (var i=0; i < surveycheck.questions.length; i++) { + var tempquestion = surveycheck.questions[i]; + if (surveyform[tempquestion.question][tempquestion.default].checked) { + error = true; + } + } + } + if (error) { + alert(mstr.survey.questionsnotanswered); + YAHOO.util.Event.preventDefault(e); + return false; + } else { + return true; + } +} + +function survey_attach_onsubmit() { + if (document.getElementById('surveyform')) { + var surveyform = document.getElementById('surveyform'); + YAHOO.util.Event.addListener('surveyform', "submit", checkform); + } +} \ No newline at end of file diff --git a/mod/survey/view.php b/mod/survey/view.php index 5ad0be6d0dd..5c1d0946844 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -158,48 +158,22 @@ exit; } -?> - -
- - - - -'; - echo ""; - - print_footer($course); - -?> +?> \ No newline at end of file