<% if edit_mode %>
@@ -31,9 +34,9 @@
-
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %>
+
diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js
index b5678e8b2..3607c3f09 100644
--- a/public/javascripts/new_user.js
+++ b/public/javascripts/new_user.js
@@ -62,8 +62,15 @@ function submit_homework(id)
{
$("#homework_name").focus();
}
- else
+ else if(!regex_homework_end_time())
+ {
+ $("#homework_end_time").focus();
+ }
+ else if(!regex_course_id())
{
+ $("#course_id").focus();
+ }
+ else{
homework_description_editor.sync();
$("#"+id).submit();
}
@@ -85,6 +92,36 @@ function regex_homework_name()
return true;
}
}
+//验证截止时间
+function regex_homework_end_time()
+{
+ var name = $.trim($("#homework_end_time").val());
+ if(name=="")
+ {
+ $("#homework_end_time_span").text("截止时间不能为空");
+ return false;
+ }
+ else
+ {
+ $("#homework_end_time_span").text("");
+ return true;
+ }
+}
+
+//验证发送到课程
+function regex_course_id(){
+ var course_id = $("#course_id").val();
+ if(course_id == -1)
+ {
+ $("#homework_course_id_span").text("发布课程不能为空");
+ return false;
+ }
+ else
+ {
+ $("#homework_course_id_span").text("");
+ return true;
+ }
+}
//老师导入作业时查询作业
function search_homework_by_name(url){