MDL-31763 mod_data: Fixed array iteration reference issue
[moodle.git] / mod / survey / survey.js
blob4f9947d6929c4ca784eafb246e5a6754d92abbb8
1 function checkform(e) {
2     var error = false;
3     if (document.getElementById('surveyform')) {
4         var surveyform = document.getElementById('surveyform');
5         for (var i=0; i < surveycheck.questions.length; i++) {
6             var tempquestion = surveycheck.questions[i];
7             if (surveyform[tempquestion['question']][tempquestion['default']].checked) {
8                 error = true;
9             }
10         }
11     }
12     if (error) {
13         alert(M.str.survey.questionsnotanswered);
14         YAHOO.util.Event.preventDefault(e);
15         return false;
16     } else {
17         return true;
18     }
21 function survey_attach_onsubmit() {
22     if (document.getElementById('surveyform')) {
23         var surveyform = document.getElementById('surveyform');
24         YAHOO.util.Event.addListener('surveyform', "submit", checkform);
25     }