增加发布时间和发送课程的js验证
This commit is contained in:
parent
9df301b4cc
commit
c8eb7804df
|
@ -15,9 +15,12 @@
|
|||
<div class="calendar_div fl">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" >
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
<div class="cl"></div>
|
||||
<div id="homework_editor" style="display: none">
|
||||
<div class="mt10">
|
||||
<% if edit_mode %>
|
||||
|
@ -31,9 +34,9 @@
|
|||
|
||||
|
||||
<div class="mt10">
|
||||
<!--<input type="text" class="InputBox W700 SearchIcon" placeholder="发送到课程" />-->
|
||||
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %>
|
||||
</div>
|
||||
<p id="homework_course_id_span" class="c_red mt5"></p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="homework_attachments">
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue