diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 75d6db2c8..e42334286 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -49,12 +49,9 @@ }); }); function check_and_submit(doc){ - $("#error").hide(); - if( check_pass == false){ - $("#error").html("贴吧名称已经存在").show(); - return; - } - if( $("input[name='forum[name]']").val().trim == "" || $("input[name='forum[description]']").val().trim == "" || check_pass == false){ + $("#error").html('').hide(); + check_forum_name(); + if( $("input[name='forum[name]']").val().trim() == "" || $("input[name='forum[description]']").val().trim() == "" ){ $("#error").html("名称和描述未填写正确").show(); return; }else{ @@ -63,6 +60,7 @@ } var check_pass = true; function check_forum_name(){ + check_pass = true; name = $("input[name='forum[name]']").val().trim(); if( name != ""){ $.get(