129 lines
4.2 KiB
Plaintext
129 lines
4.2 KiB
Plaintext
<script type="text/javascript">
|
|
function regexName()
|
|
{
|
|
var name = $.trim($("#bid_name").val());
|
|
|
|
if(name=="")
|
|
{
|
|
$("#bid_name_span").text("名称不能为空");
|
|
$("#bid_name_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
$("#bid_name_span").text("填写正确");
|
|
$("#bid_name_span").css('color','#008000');
|
|
return true;
|
|
}
|
|
}
|
|
function regexDeadLine()
|
|
{
|
|
var deadline = $.trim($("#bid_deadline").val());
|
|
var regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
if(deadline=="")
|
|
{
|
|
$("#bid_deadline_span").text("截止日期不能为空");
|
|
$("#bid_deadline_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
else if(regex.test(deadline))
|
|
{
|
|
$("#bid_deadline_span").text("填写正确");
|
|
$("#bid_deadline_span").css('color','#008000');
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
$("#bid_deadline_span").text("截止日期格式错误");
|
|
$("#bid_deadline_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
}
|
|
function regexEvaluationNum()
|
|
{
|
|
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
|
var regex = /^\d+$/;
|
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
|
{
|
|
if(evaluation_num=="")
|
|
{
|
|
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
else if(regex.test(evaluation_num))
|
|
{
|
|
if(evaluation_num > 0)
|
|
{
|
|
$("#bid_evaluation_num_span").text("填写正确");
|
|
$("#bid_evaluation_num_span").css('color','#008000');
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
|
$("#bid_evaluation_num_span").css('color','#ff0000');
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$(function(){
|
|
$("#bid_open_anonymous_evaluation").click(function(){
|
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
|
{
|
|
$("#evaluation_num_p").slideDown();
|
|
}
|
|
else
|
|
{
|
|
$("#evaluation_num_p").slideUp();
|
|
}
|
|
});
|
|
});
|
|
$(function(){
|
|
$("#bid_open_anonymous_evaluation").click(function(){
|
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
|
{
|
|
$("#evaluation_num_p").slideDown();
|
|
$("#open_anonymous_evaluation_span").slideUp();
|
|
}
|
|
else
|
|
{
|
|
$("#evaluation_num_p").slideUp();
|
|
$("#open_anonymous_evaluation_span").slideDown();
|
|
}
|
|
});
|
|
});
|
|
|
|
function submitHomework(id)
|
|
{
|
|
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
|
{
|
|
$("#edit_bid_" + id).submit();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<h3><%= l(:label_edit_homework) %></h3>
|
|
|
|
<%= labelled_form_for @bid do |f| %>
|
|
<div class="box tabular">
|
|
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
|
|
<%= render :partial => 'homework_form', :locals => { :f => f } %>
|
|
<!--<input type="button" onclick="submitHomework(<%#= @bid.id%>);" value="<%#= l(:button_create)%>" class="enterprise">-->
|
|
<a href="#" onclick="submitHomework(<%= @bid.id%>);" class="ButtonColor m3p10" >
|
|
<%= l(:button_create)%>
|
|
</a>
|
|
<% end %>
|
|
</div> |