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(); } }