在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
end
When click submit_tag "Cancel", the paramsi are:
{"button_identifier"=>"", "check_box2"=>"selected", "commit"=>"Cancel", "radio_button"=>"2 was selected", "action"=>"test_action", "controller"=>"index", "text_tag"=>"default_content", "text_area"=>"default_content", "password"=>"", "file"=>"", "select"=>"option2"} if params[:commit] == "Cancel"**************** In form_tag, if you put multiple submit button, like <%= submit_tag("Update", :name=>"submit"%> <%= submit_tag("Delete", :name=>"submit"%> The value of params[:submit] depends on which button you click, either "Update" or "Delete". However, in form_remote_tag, no matter you click which button, params[:submit] is always "Update". Solution to this defect: <%= hidden_field_tag "button_identifier" %> <%= submit_tag("Update", :name=>"submit",:onclick=>"$ ('button_identifier').value='Update'") %> <%= submit_tag("Delete", :name=>"submit", :onclick=>"$ ('button_identifier').value='Delete') %> 给form_tag 指定 class的CSS样式
<% form_tag url_for(:action => "aaa"),:class => "clearfix setsmt" do%>
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论