From d9c0809f53772a20fb9738c13086149fb6d13b02 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 23 Sep 2015 11:27:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=B8=96=E5=AD=90=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E5=88=86=E5=BC=80=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/show.html.erb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 58beadb29..2fba3af1b 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -55,10 +55,15 @@ }); function check_and_submit(){ - if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" && check_memo_name()){ + if(!check_memo_name()){ + return; + } + if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){ $("#new_memo").submit(); - }else{ - $("#error").html("主题和内容不能为空").show(); + }else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){ + $("#error").html("主题不能为空").show(); + }else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){ + $("#error").html("内容不能为空").show(); } }