From 3e0609afe3a0e8f85d0dc7779dd5e41bc41203b1 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 25 Nov 2015 10:24:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E6=97=B6=E9=95=BF=E5=92=8C?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E5=88=86=E6=95=B0=E5=A2=9E=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_form.html.erb | 6 ++++++ 1 file changed, 6 insertions(+) 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();