diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index cabd0b5e4..6b8e93bd0 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -87,6 +87,8 @@ var standard_ans = $.trim($("#question_standard_ans").val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); + }else if(!/^[1-9][0-9]*$/.test(score)) { + alert("分数必须是非零开头的数字"); }else if(quest_type !=3 && standard_ans.length == 0) { alert("标准答案不能为空"); }else{ @@ -100,6 +102,8 @@ var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); + }else if(!/^[1-9][0-9]*$/.test(score)) { + alert("分数必须是非零开头的数字"); }else if(quest_type !=3 && standard_ans.length == 0) { alert("标准答案不能为空"); }else{ @@ -116,6 +120,8 @@ alert("截止时间不能为空"); } else if(Date.parse($("#exercise_end_time").val()) < Date.now()) { alert("截止时间不能小于当前时间"); + } else if($.trim($("#exercise_time").val()) !="" && !/^[1-9][0-9]*$/.test($.trim($("#exercise_time").val()))) { + alert("测验时长必须为非零开头的数字"); } else { doc.parent().parent().parent().submit();