这不是我正在使用的唯一远程表单,但我在这里看不到问题。这是一个简单的表,其中每一行都有自己的表单和内联表单字段。
<% for temporary_address in @temporary_addresses %>
<tr id="row-<%= temporary_address.id -%>">
<%= form_for temporary_address, :remote => true do |form| %>
<td>
<%= link_to "x", temporary_address, :method => :delete, :remote => true %>
<%= form.submit "s" %>
</td>
[... form fields ...]
<% end %>
</tr>
<% end %>
但是,这只适用于:remote =&gt;如果不,则为true。
resources :temporary_addresses
在路径文件中。删除链接正在运行,表单在不使用时也正常工作:remote =&gt;真。
使用remote =&gt;按提交是给出
Started POST "/temporary_addresses/12" for 127.0.0.1 at 2011-07-17 12:45:26 +0200
ActionController::RoutingError (No route matches "/temporary_addresses/12")
并提交没有远程=&gt; true 适用于以下回复
Started POST "/temporary_addresses/12" for 127.0.0.1 at 2011-07-17 12:46:15 +0200
Processing by TemporaryAddressesController#update as HTML
Parameters: {[...] "commit"=>"s", "temporary_address"=>{[...]}, "id"=>"12"}
有人对此有所了解吗?
编辑1 删除了link_to:remote以销毁要检查的记录。同样的错误...
呈现的表单如下所示:
<tr id="row-1">
<td>
</td>
<form accept-charset="UTF-8" action="/temporary_addresses/1" class="edit_temporary_address" data-remote="true" id="edit_temporary_address_1" method="post">
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" />
<input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="vpFbYO7L9fVtBsWej37FUBobraYjjdWA/F8AjWTwC7A=" />
</div>
<td>
<input id="temporary_address_firstname" name="temporary_address[firstname]" size="30" type="text" value="John" />
</td>
<td>
<input id="temporary_address_lastname" name="temporary_address[lastname]" size="30" type="text" value="Doe" />
</td>
<td>
<input id="temporary_address_email" name="temporary_address[email]" size="30" type="text" value="john.doe@example.com" />
</td>
<td>
New record
</td>
<td>
<input id="temporary_address_submit" name="commit" type="submit" value="save" />
</td>
</form>
</tr>
答案 0 :(得分:0)
解决!
简单的事情..当Firefox无效时,它会重新排列内容。上面给出的输出是源代码。现在我已经看到了生成的源代码(感谢Web开发工具栏)问题很明显:在div中生成的隐藏表单字段显示为:none已经移到了表单之外。