Hello people,
how can I append a text_field_tag to a form_for? When I submit the form
all text_field_tags are not being appended to the params…
Hello people,
how can I append a text_field_tag to a form_for? When I submit the form
all text_field_tags are not being appended to the params…
You probably just have a typo in your code…
If you include a
<%= text_field_tag ‘firstname’ %>
in your form, then you can get the value in the controller using
params[:firstname]
If you use nested resources, a
<%= text_field_tag ‘user[firstname]’ %>
in your form, will result in
params[:user][:firstname]
in your controller.
Regards,
Tom
I have it exactly like you said:
<%= text_field_tag “type[#{cat.name}]”, 0, :size => 1, :id =>
“type_#{cat.id}”, :disabled => true %>
or rather:
But I only get the fields used with the form_for (all form.text_field
inputs). None of the text_field_tags is in the params array.
Disabled items don’t come back in the params, perhaps you need a hidden
field?
I just tweaked the first name field on a person edit form to be
disabled, and the value did not come back in the params.
Yeah, that was it. Thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs