socialforge/app/views/contestnotifications/_form.html.erb

78 lines
2.5 KiB
Plaintext
Raw Normal View History

2014-06-04 20:29:15 +08:00
<%= error_messages_for @contestnotifications %>
<script type="text/javascript">
function regexTitle()
{
var title = $.trim($("#contestnotification_title").val());
if(title.length ==0)
{
$("#title_span").text("<%= l(:label_no_contest_news_title) %>");
$("#title_span").css('color','#ff0000');
$("#title_span").focus();
return false;
}
else if(title.length <= 254)
{
$("#title_span").text("<%= l(:label_field_correct) %>");
$("#title_span").css('color','#008000');
return true;
}
else
{
$("#title_span").text("<%= l(:label_contest_news_title_condition) %>");
$("#title_span").css('color','#ff0000');
$("#title_span").focus();
return false;
}
}
//验证描述不能为空不能多余5000个字符
function regexDescription()
{
var description = $.trim($("#contestnotification_description").val());
if(description.length ==0)
{
$("#description_span").text("<%= l(:label_no_contest_news_description) %>");
$("#description_span").css('color','#ff0000');
$("#description_span").focus();
return false;
}
else if(description.length <= 5000)
{
$("#description_span").text("<%= l(:label_field_correct) %>");
$("#description_span").css('color','#008000');
return true;
}
else
{
$("#description_span").text("<%= l(:label_contest_news_condition) %>");
$("#description_span").css('color','#ff0000');
$("#description_span").focus();
return false;
}
}
</script>
2014-06-04 20:29:15 +08:00
<div class="box tabular">
<p>
<%= f.text_field :title,
:required => true,
:size => 60,
:maxlength => 60,
:style => "width:488px;",
:onkeyup => "regexTitle();"
%>
</p>
<span id="title_span" style="padding-left: 100px;"></span>
<p>
<%= f.text_area :description,
:required => true,
:cols => 60,
:rows => 11,
:class => 'wiki-edit',
:style => "width:490px;",
:onkeyup => "regexDescription();"
%>
</p>
<span id="description_span" style="padding-left: 100px;"></span>
2014-06-04 20:29:15 +08:00
</div>
<%= wikitoolbar_for 'news_description' %>