I need my forms to have HTML id or class but seems there is not such parameter in form_tag or form_tag_for. At least not in the rails doc. I''ve been searching for a while and I couldn''t find a workarround without pure HTML or gsub! which wouldn''t be pretty. 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 -~----------~----~----~----~------~----~------~--~---
Macario Ortega wrote:> > > I need my forms to have HTML id or class but seems there is not such > parameter in form_tag or form_tag_for. At least not in the rails doc. > I''ve been searching for a while and I couldn''t find a workarround > without pure HTML or gsub! which wouldn''t be pretty. > > > Thanks.in http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M000607 is written form_tag(/posts/1, :method => :put) # output - <form action="/posts/1" method="put"> so, try doing (untested) form_tag(/posts/1, :id => :id_name, :class=> :class_name ) # output - <form action="/posts/1" method="put"> and u should be good. hth -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> so, try doing (untested) > > form_tag(/posts/1, :id => :id_name, :class=> :class_name ) > # output - <form action="/posts/1" method="put">oops, i meant form_tag(/posts/1, :id => :id_name, :class=> :class_name ) # output - <form action="/posts/1" id="id_name" class="class_name"> :) -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld wrote:>> so, try doing (untested) >> >> form_tag(/posts/1, :id => :id_name, :class=> :class_name ) >> # output - <form action="/posts/1" method="put"> > > oops, i meant > > form_tag(/posts/1, :id => :id_name, :class=> :class_name ) > # output - <form action="/posts/1" id="id_name" class="class_name"> > > :)Thaks for the quick reply. I''ve tried this with form_remote: <% form_remote_for( :comentario, :url => comentario_path(@comentario), :html => { :method => :put }, :update => @id.to_s, :id => :fade_out ) do |f| %> and this <% form_remote_for( :comentario, :url => comentario_path(@comentario), :html => { :method => :put, :id => :fade_out }, :update => @id.to_s, ) do |f| %> and doesn''t work you should be able to specify the html id and class for every rendered element. Any workarround for form_remote_for, link_to_remote or every other element? appending gsub!(/^(<.*) /, ''</1 id="wathever"'' or something similar to the expression return should do but doesn''t looks too good. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld wrote:>> so, try doing (untested) >> >> form_tag(/posts/1, :id => :id_name, :class=> :class_name ) >> # output - <form action="/posts/1" method="put"> > > oops, i meant > > form_tag(/posts/1, :id => :id_name, :class=> :class_name ) > # output - <form action="/posts/1" id="id_name" class="class_name"> > > :)Yep, you where right, sorry. This works: :html => { :method => :put, :style => "float:right;"} 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---