评分的回复连续点击多次防止提交多次表单

This commit is contained in:
cxt 2016-05-13 10:57:45 +08:00
parent f1821e54e1
commit 345e1c0a48
1 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,14 @@
<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%>
<%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
<input type="hidden" value="<%= is_last%>" name="is_last">
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="$('#add_score_reply_<%= score.id%>').find('form').submit();">回复</a>
<% end%>
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="add_score_Reply_submit('<%=score.id %>');">回复</a>
<script type="text/javascript">
var first_click = true;
function add_score_Reply_submit(id){
if(first_click) {
first_click = false;
$('#add_score_reply_'+id).find('form').submit();
}
}
</script>
<% end%>