I have the following:
<% form_remote_for :role, :method => :put, :url => {:controller =>
“roles”, :action => “update”, :id => @role.id
} do |f| %>
<%= select("role", "default_view", Account::ROLES) %> |
<%= submit_tag("Update"); %> |
|
<% end -%>
Controller code:
def update
role = Role.find(params[:id])
role.update_attributes(params[:role])
render :update do |page|
logger.info "update: " + debug(params)
end
the “debug(params)” outputs:
update:
— !map:HashWithIndifferentAccess
_method: put
action: update
id: “6”
controller: roles
There is no “default_view” field from my drop down. Just the params
passed on the URL string. Not sure why this is happening.
Thanks for any help
I solved it: Don’t put your form tag under a
2009/1/9 Allen W. [email protected]
I solved it: Don’t put your form tag under a
tag. Argh.
*Is this a Rails bug? *
Just hit the same issue, i.e. my field attributes were not being passed
within a “remote_form_for” that was within a table.
How is one supposed to work around this if you need an AJAX form call
within
part of a table, and the table is required for the existing layout of
the
page?
2009/2/19 Greg H. [email protected]
2009/1/9 Allen W. [email protected]
I solved it: Don’t put your form tag under a
tag. Argh.
I see that you can put a form in a table, but it has to fit entirely
within
a table cell (not perfect answer, but better than not being able to use
a
table at all)
No, it’s not a Rails bug - lrn2html. (ref:
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.1
)
Typically, one puts the table in the form, not the other way around.
The HTML spec is pretty specific about what can go inside the table
tag
without being contained by a cell.
I’d also add, in reference to the original code, that you should be
using
f.select(:default_view, Account::ROLES) - form_for and friends pass
the
builder to the block.
–Matt J.
On Feb 19, 12:17 am, Greg H. [email protected]
On 20 Feb 2009, at 10:52, Greg H. wrote:
fair enough - interesting through things worked fine with
“form_for”, and it was just when moving to “remote_form_for” the
issue kicked in…
Probably because with remote_form_for the serialization happens in
javascript. You’re going down a different codepath and so the
undefined behaviour may be different.
Fred
fair enough - interesting through things worked fine with “form_for”,
and it
was just when moving to “remote_form_for” the issue kicked in…
2009/2/20 Matt J. [email protected]
I’d also add, in reference to the original code, that you should be
–
Greg
http://blog.gregnet.org/