回复留言为空则不能提交

This commit is contained in:
huang 2016-05-06 21:19:35 +08:00
parent d672c80edb
commit 8323422f09
1 changed files with 29 additions and 2 deletions

View File

@ -19,11 +19,12 @@
<div class="sn-replybox">
<h2 class="sn-reply-h2">留言板<span class="sn-fr sn-f14 sn-font-grey3 sn-mt10"><%= count %>条留言</span></h2>
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'sub_document_comments', :id => @document.id, :flag => true}, :html => {:multipart => true, :id => 'message_form', :class => "sn-reply-form", } do |f| %>
<textarea class="sn-reply-text" name="sub_content" ></textarea>
<textarea class="sn-reply-text" name="sub_content" id="text_submain"></textarea>
<%#= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor', :class => "sn-reply-text" %>
<div class="sn-reply-btnbox">
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "$('#message_form').submit();", :class => "submit-btn" %>
<a href="javascript:void(0)" onclick = "org_new_files_upload()" class = "submit-btn">发表</a>
</div>
<p id="sub_domain_reply" style="display: none;color: #ff0000">内容不能为空</p>
<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
<% end %>
@ -81,4 +82,30 @@
target.eq(2).show();
}
}
//验证搜索时输入字
function regexName_submain(content) {
var name = $.trim($("#name").val());
if (name.length == 0) {
$("#project_name_span").text(content);
$("#project_name_span").css('color', '#ff0000');
$("#project_name_span").focus();
return false;
}
else {
$("#project_name_span").text("");
return true;
}
}
function org_new_files_upload(){
var name = $.trim($("#text_submain").val());
// content = $("#text_submain").val();
if (name.length == 0) {
$("#sub_domain_reply").show();
}
else {
$("#message_form").submit();
}
}
</script>