From: samhemelryk Date: Thu, 25 Jun 2009 03:46:59 +0000 (+0000) Subject: mod-survey MDL-16706 Removed inline script in survey and added survey.js X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=74ef4c2e5aafba06febe475afb112de9584e8c8c;p=moodle.git mod-survey MDL-16706 Removed inline script in survey and added survey.js --- diff --git a/mod/survey/survey.js b/mod/survey/survey.js new file mode 100644 index 0000000000..fba33b5698 --- /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 5ad0be6d0d..5c1d094684 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -158,48 +158,22 @@ exit; } -?> - -
- - - - -'; - echo ""; + echo '
'; + echo ''; + echo ''; + echo ""; - print_footer($course); + print_footer($course); -?> +?> \ No newline at end of file