项目名称不能为空提示

This commit is contained in:
huang 2015-04-20 14:54:04 +08:00
parent 8dd0e985a0
commit 93e3247685
2 changed files with 33 additions and 4 deletions

View File

@ -1,3 +1,4 @@
<%= error_messages_for 'project' %>
<%= labelled_form_for @project do |f| %>
<ul class="newpro_box ">
<li class="ml45 mb10">
@ -7,7 +8,9 @@
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;名称&nbsp;&nbsp;</label>
<input id="project_name" name="project[name]" class=" w543" type="text" value="<%= @project.name%>">
<!--<input id="project_name" name="project[name]" class=" w543" type="text" value="<%#= @project.name%>">-->
<input type="text" name="project[name]" id="project_name" class="w543" maxlength="100" onkeyup="regex_project_name();" value="<%= @project.name %>">
<span class="c_red ml110" id="project_name_notice" style="display: none;">项目名称不能为空!</span>
</li>
<div class="cl"></div>
@ -32,6 +35,6 @@
<div class="cl"></div>
</li>
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="$('#edit_project_<%= @project.id%>').submit();">保存</a>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>
<div class="cl"></div>

View File

@ -90,7 +90,7 @@ function regexContent() {
return false;
}
// 项目编辑和提交
// 项目讨论区编辑和提交
function submitProjectsBoard() {
if (regexSubject() && regexContent()) {
$("#message-form").submit();
@ -161,7 +161,7 @@ function course_setting(id) {
$('#tbc_0' + (3 - id)).removeClass().addClass("undis");
}
//项目类型
//项目类型(朋友圈、开发组、科研组)
function show_window() {
$('#light').css('display', 'block');
$('#fade').css('display', 'block');
@ -189,6 +189,32 @@ function project_setting(n) {
}
}
}
//配置-验证项目名称
function regex_project_name()
{
var name = $.trim($("#project_name").val());
if(name.length == 0)
{
$("#project_name_notice").show();
return false;
}
else
{
$("#project_name_notice").hide();
return true;
}
}
//配置-信息提交
function submit_edit_project(id)
{
if(regex_project_name())
{
$("#edit_project_"+id).submit();
}
}
//配置--成员---申请列表--拒绝
function refusal_applied_member() {
$('#new_membership').append("<input name = 'refusal_button' style='display: none;'>");