Hi all, I have a form: <%= form_tag ''/admin/update_node'' %> <%= hidden_field_tag(''id'', showtree.id) %> <%= text_field(''name'', showtree.name, {:size => 20, :value => showtree.name}) %> <%= submit_tag(''Save'') %> <% end_form_tag %> rendered in html <form action="/admin/update_node" method="post"> <input id="id" name="id" value="9" type="hidden"> <input id="name_SelfMate II" name="name[SelfMate II]" size="20" value="SelfMate II" type="text"> <input name="commit" value="Save" type="submit"> </form> and the controller function def update_node Node.update(params[:id], {:name => params[:name]}) redirect_to(:action => index) end When I save, the record (name) gets returned with a lot of garbage (lines and newlines). Can someone tell me what I''m doing wrong? Thanks in advance Stijn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> When I save, the record (name) gets ??????returned????? with a lot ofgarbage Your description is not precise... unable to comply :-( 2007/1/25, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > Hi all, > > I have a form: > <%= form_tag ''/admin/update_node'' %> > <%= hidden_field_tag(''id'', showtree.id) %> > <%= text_field(''name'', showtree.name, {:size => 20, :value => > showtree.name}) %> > <%= submit_tag(''Save'') %> > <% end_form_tag %> > > rendered in html > <form action="/admin/update_node" method="post"> > <input id="id" name="id" value="9" type="hidden"> > <input id="name_SelfMate II" name="name[SelfMate II]" size="20" > value="SelfMate II" type="text"> > <input name="commit" value="Save" type="submit"> > </form> > > and the controller function > def update_node > Node.update(params[:id], {:name => params[:name]}) > redirect_to(:action => index) > end > > When I save, the record (name) gets returned with a lot of garbage > (lines and newlines). > > Can someone tell me what I''m doing wrong? > > Thanks in advance > Stijn > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tarscher wrote:> Hi all, > > I have a form: > <%= form_tag ''/admin/update_node'' %> > <%= hidden_field_tag(''id'', showtree.id) %> > <%= text_field(''name'', showtree.name, {:size => 20, :value => > showtree.name}) %> > <%= submit_tag(''Save'') %> > <% end_form_tag %> > > rendered in html > <form action="/admin/update_node" method="post"> > <input id="id" name="id" value="9" type="hidden"> > <input id="name_SelfMate II" name="name[SelfMate II]" size="20" > value="SelfMate II" type="text"> > <input name="commit" value="Save" type="submit"> > </form> > > and the controller function > def update_node > Node.update(params[:id], {:name => params[:name]}) > redirect_to(:action => index) > end > > When I save, the record (name) gets returned with a lot of garbage > (lines and newlines).params[:name] will be a Hash rather than a String because the name property of the text field is "name[SelfMate II]". You probably want to use the text_field_tag helper rather than the text_field helper. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---