MDL-50015 mod_imscp: New WS mod_imscp_view_imscp
[moodle.git] / mod / survey / survey.js
CommitLineData
74ef4c2e 1
2de3515f
PS
2M.mod_survey = {};
3
4M.mod_survey.init = function(Y) {
74ef4c2e 5 if (document.getElementById('surveyform')) {
6 var surveyform = document.getElementById('surveyform');
2de3515f
PS
7 Y.YUI2.util.Event.addListener('surveyform', "submit", function(e) {
8 var error = false;
9 if (document.getElementById('surveyform')) {
10 var surveyform = document.getElementById('surveyform');
11 for (var i=0; i < surveycheck.questions.length; i++) {
12 var tempquestion = surveycheck.questions[i];
13 if (surveyform[tempquestion['question']][tempquestion['default']].checked) {
14 error = true;
15 }
16 }
17 }
18 if (error) {
64e7aa4d 19 alert(M.util.get_string('questionsnotanswered', 'survey'));
2de3515f
PS
20 Y.YUI2.util.Event.preventDefault(e);
21 return false;
22 } else {
23 return true;
24 }
25 });
74ef4c2e 26 }
2de3515f 27};