Rails远程表单不发布表单参数 [英] Rails Remote Form does not post form parameters

查看:88
本文介绍了Rails远程表单不发布表单参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题涉及带有远程表单的以下部分视图:

my question involves the following partial view with a remote form:

 <% remote_form_for :phone_number, :url => {:controller => "edit", :action => "add_phone_number" }, :update => "phone_number_div" do |form| %>
    <%= form.text_field :number%>
    <%= form.select :type, PhoneNumber::PHONE_TYPE%>
    <%= submit_tag "Add" %>     
 <% end %>

按下Add按钮时,将发布add_phone_number操作,但是表单值不在params变量中.

When the Add button is pressed, the add_phone_number action is posted to, but the form values are not in the params variable.

有人知道为什么会这样吗?

Does anyone know why this could be?

推荐答案

如果表单元素是DOM中非法位置的子节点(例如TR内,例如(而不是在TD中).

Most browsers won't pass the form values in the post if the form element is a child node in an illegal location in the DOM (like inside a TR, for example (and not in a TD).

我曾经遇到过这个问题.

I ran into this problem once.

这篇关于Rails远程表单不发布表单参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆