Peter Marks
2008-Jan-18 02:15 UTC
How to modify the html name attribute of a generated input?
How can I change the html name attribute of an input? I''ve tried the approach used to change the name of a form object: <%= text_field({''object'', ''field''}, ''my_name'') %></p> But it only added to the name attribute instead of replacing it: <input id="objectfield_namemy_name" name="objectfield[namemy_name]" size="30" type="text" /> Any idea how I could replace the name attribute completely? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keynan Pratt
2008-Jan-18 07:40 UTC
Re: How to modify the html name attribute of a generated inp
Use text_field_tag(). p.s. why do you want to break the convention? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Peter Marks
2008-Jan-18 17:40 UTC
Re: How to modify the html name attribute of a generated inp
Keynan Pratt wrote:> Use text_field_tag(). > > p.s. why do you want to break the convention?I''m trying to test form automation with www::mechanize. From the syntax I''m using (form.field = X), mechanize reads the rails name tags incorrectly. In my above example, it reads name=objectfield[namemyname] as name=objectfield and can''t find that page element. text_field_tag and select_tag work wonderfully for setting a name attribute and testing this though. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---