Hello, Is there a way to set the html element id for the form_tag and form_remote_tag on the server side? I want to have this resultant html... <form id=''something'' ... ... </form> Thank you, Brian Takita
You can specify HTML attributes in the ''options'' parameter: form_tag(url_for_options = {}, options = {}, *parameters_for_url) Eszter -- Primalgrasp LLC http://primalgrasp.com
Thanks Biro... How about the form_remote_tag? I only see the argument options... form_remote_tag(options = {}) When I do this: form_remote_tag( :id=>''something'', ... ) It thinks the ID means the ID in the url rather than the form''s html id. What am I doing wrong? :) Thank you, Brian On 9/13/05, Biro Eszter <biro.eszter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > You can specify HTML attributes in the ''options'' parameter: > form_tag(url_for_options = {}, options = {}, *parameters_for_url) > > Eszter > > -- > Primalgrasp LLC > http://primalgrasp.com >
Aha... I think I got it. form_remote_tag( :html=> {:id=>''something''}, ... ) will result in <from id="something" ... Thank you Biro. One question... Is the hash passed to the :html key the same as the options argument in the form_tag method? If so, maybe that could be indicated in the documentation. Brian On 9/13/05, Brian Takita <brian.takita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Biro... > > How about the form_remote_tag? > > I only see the argument options... > form_remote_tag(options = {}) > > When I do this: > > form_remote_tag( > :id=>''something'', > ... > ) > > It thinks the ID means the ID in the url rather than the form''s html id. > What am I doing wrong? :) > > Thank you, > Brian > > On 9/13/05, Biro Eszter <biro.eszter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You can specify HTML attributes in the ''options'' parameter: > > form_tag(url_for_options = {}, options = {}, *parameters_for_url) > > > > Eszter > > > > -- > > Primalgrasp LLC > > http://primalgrasp.com > > >
Can''t do it... wrong number of arguments (2 for 1) form_remote_tag expects one Hash. Maybe the interface is different from form_tag because there is the javascript and html functionality (for browsers with JS disabled) in the form_remote_tag? On 9/13/05, Biro Eszter <biro.eszter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Brian, > > In my opinion you should write as: > form_remote_tag( {...}, > {:id=>''something''} ) > The parameters passed in the first bracket are values passed as URL > parameters. > In the second(''options'') bracket you pass the HTML attributes. > > Hope it helps, > Eszter > > > Brian Takita wrote: > > Thanks Biro... > > > > How about the form_remote_tag? > > > > I only see the argument options... > > form_remote_tag(options = {}) > > > > When I do this: > > > > form_remote_tag( > > :id=>''something'', > > ... > > ) > > > > It thinks the ID means the ID in the url rather than the form''s html id. > > What am I doing wrong? :) > > > > Thank you, > > Brian > > > > On 9/13/05, Biro Eszter <biro.eszter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >>You can specify HTML attributes in the ''options'' parameter: > >>form_tag(url_for_options = {}, options = {}, *parameters_for_url) > >> > >>Eszter > >> > >>-- > >>Primalgrasp LLC > >>http://primalgrasp.com > >> > > > > > > > -- > Primalgrasp LLC > http://primalgrasp.com >
> Is the hash passed to the :html key the same as the options argument in the form_tag method?As a confirmation, the :html key to the Hash argument is the same as the options argument in the form_tag method.> def form_remote_tag(options = {}) > options[:form] = true > > options[:html] ||= {} > options[:html][:onsubmit] = "#{remote_function(options)}; return false;" > options[:html][:action] = options[:html][:action] || url_for(options[:url]) > options[:html][:method] = options[:html][:method] || "post" > > tag("form", options[:html], true) > endOn 9/13/05, Brian Takita <brian.takita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Aha... > > I think I got it. > > form_remote_tag( > :html=> {:id=>''something''}, > ... > ) > > will result in > <from id="something" ... > > Thank you Biro. > > One question... > Is the hash passed to the :html key the same as the options argument > in the form_tag method? > > If so, maybe that could be indicated in the documentation. > > Brian > > On 9/13/05, Brian Takita <brian.takita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thanks Biro... > > > > How about the form_remote_tag? > > > > I only see the argument options... > > form_remote_tag(options = {}) > > > > When I do this: > > > > form_remote_tag( > > :id=>''something'', > > ... > > ) > > > > It thinks the ID means the ID in the url rather than the form''s html id. > > What am I doing wrong? :) > > > > Thank you, > > Brian > > > > On 9/13/05, Biro Eszter <biro.eszter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > You can specify HTML attributes in the ''options'' parameter: > > > form_tag(url_for_options = {}, options = {}, *parameters_for_url) > > > > > > Eszter > > > > > > -- > > > Primalgrasp LLC > > > http://primalgrasp.com > > > > > >
François Beausoleil
2005-Sep-13 17:01 UTC
Re: form_tag & form_remote_tag html id attribute
Hello Brian ! Can you update the documentation and submit a patch, or simply send me, off-list, the revised text and I will make a patch. Thanks for your sleuthing ! François Brian Takita said the following on 2005-09-13 12:51:> As a confirmation, the :html key to the Hash argument is the same as > the options argument in the form_tag method.