通知和新闻详情页面的回复点击多次不会提交表单多次

This commit is contained in:
cxt 2016-05-13 10:56:48 +08:00
parent cc92105da9
commit f1821e54e1
5 changed files with 18 additions and 3 deletions

View File

@ -186,7 +186,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');"> <a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %> <%= l(:label_cancel_with_space) %>
</a> </a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();"> <a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %> <%= l(:label_comment_with_space) %>
</a> </a>
</p> </p>
@ -199,6 +199,9 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){ $("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html(); var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," "); postContent = postContent.replace(/&nbsp;/g," ");

View File

@ -161,7 +161,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');"> <a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %> <%= l(:label_cancel_with_space) %>
</a> </a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();"> <a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %> <%= l(:label_comment_with_space) %>
</a> </a>
</p> </p>
@ -174,6 +174,9 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){ $("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html(); var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," "); postContent = postContent.replace(/&nbsp;/g," ");

View File

@ -171,7 +171,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');"> <a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %> <%= l(:label_cancel_with_space) %>
</a> </a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();"> <a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %> <%= l(:label_comment_with_space) %>
</a> </a>
</p> </p>
@ -184,6 +184,9 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){ $("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html(); var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," "); postContent = postContent.replace(/&nbsp;/g," ");

View File

@ -380,6 +380,9 @@ function newsReplyVerify() {
if(comment_editor.isEmpty()) { if(comment_editor.isEmpty()) {
$("#add_reply_news").text("评论不能为空"); $("#add_reply_news").text("评论不能为空");
$("#add_reply_news").css('color', '#ff0000'); $("#add_reply_news").css('color', '#ff0000');
$("#news_submit_comment").one('click',function(){
submitComment();
});
return false; return false;
} else { } else {
$("#add_reply_news").text("填写正确"); $("#add_reply_news").text("填写正确");

View File

@ -286,6 +286,9 @@ function newsReplyVerify() {
if(comment_editor.isEmpty()) { if(comment_editor.isEmpty()) {
$("#add_reply_news").text("评论不能为空"); $("#add_reply_news").text("评论不能为空");
$("#add_reply_news").css('color', '#ff0000'); $("#add_reply_news").css('color', '#ff0000');
$("#news_submit_comment").one('click',function(){
submitComment();
});
return false; return false;
} else { } else {
$("#add_reply_news").text("填写正确"); $("#add_reply_news").text("填写正确");