diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 89faf39e3..62312932d 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -90,7 +90,7 @@ function f_submit() { var subject = $("#memo_subject").val(); var content = $("#memo_content_1").val(); - $("#memo_subject").val(subject+":"+ content.substr(0,18)); + $("#memo_subject").val(subject+":"+ content.substr(0,18)+"..."); $("#new_memo").submit(); } @@ -137,6 +137,20 @@ function cookieget(n) durationTime : 600 }); }); + + $(document).ready(function(){ + $("#memo_content_1").keydown(function(){ + var curLength=$("#memo_content_1").val().length; + if(curLength>=50){ + var num=$("#memo_content_1").val().substr(0,49); + $("#memo_content_1").val(num); + alert("超过意见反馈内容字数限制,多出的内容将被截断!" ); + } + else{ + $("#textCount").text(49-$("#memo_content_1").val().length) + } + }) + })
@@ -149,7 +163,8 @@ function cookieget(n) <%= f.hidden_field :subject,:required => true , :value => l(:label_feedback_value) %> <%= f.text_area :content,:class => "opnionText",:id=>"memo_content_1" ,:placeholder => l(:label_feedback_tips) %> <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> - <%= l(:label_submit)%> + + <%= l(:label_submit)%> <% end %>
diff --git a/public/javascripts/feedback.js b/public/javascripts/feedback.js index dfd3e10b2..c55cfd5c3 100644 --- a/public/javascripts/feedback.js +++ b/public/javascripts/feedback.js @@ -55,8 +55,8 @@ $(function(){ function f_submit() { var subject = $("#memo_subject").val(); - var content = $("#memo_content_1").val(); - $("#memo_subject").val(subject+":"+ content.substr(0,18)); + var content = $("#memo_content").val(); + $("#memo_subject").val(subject+":"+ content.substr(0,18)+"..."); $("#new_memo").submit(); } @@ -99,13 +99,6 @@ $(function(){ }); }); -function f_submit() -{ - var subject = $("#memo_subject").val(); - var content = $("#memo_content").val(); - $("#memo_subject").val(subject+":"+ content.substr(0,18)); - $("#new_memo").submit(); -} $(document).ready(function () {