i guess its better form to keep form tags outside of table tags anyways, but it took a lot of trial and error to figure out thats why @params were no longer showing up after switching form_tag to form_remote_tag. not sure if this is a prototype ''bug'' or ''feature'' or what. but my next step was to switch to a seperate form tag for each row to reduce needless bandwidth/db usage but that isnt possible due to this behavior.. i guess i will spend another few weeks figuring out if it will ever be posible to get distinct divs to truly line up their nested subelements like table cells do... -- Posted via http://www.ruby-forum.com/.
carmen wrote:> i guess its better form to keep form tags outside of table tags anyways, > but it took a lot of trial and error to figure out thats why @params > were no longer showing up after switching form_tag to form_remote_tag. > not sure if this is a prototype ''bug'' or ''feature'' or what. but my next > step was to switch to a seperate form tag for each row to reduce > needless bandwidth/db usage but that isnt possible due to this > behavior.. i guess i will spend another few weeks figuring out if it > will ever be posible to get distinct divs to truly line up their nested > subelements like table cells do...Has anyone looked into this? I assume it has to do with tag parsing. The following code works: <div id="search-tab"> <%= form_remote_tag :update => ''search-results'', :url => { :action => ''search'', :controller => ''home'' }, :loading => "Element.show(''activity'')", :complete => "Element.hide(''activity''); Element.show(''search-box''); new Effect.SlideDown(''search-box'')" %> <table> <tr> <td><%= image_tag ''activity-black.gif'', :id => ''activity'', :style => ''display:none'' %></td> <td><%= text_field_tag ''term'' %></td> <td><%= image_submit_tag ''/images/search3.gif'' %></td> </tr> </table> <%= end_form_tag %> </div> But if you put the <form></form> tags within the table like the following: <table> <div id="search-tab"> <%= form_remote_tag :update => ''search-results'', :url => { :action => ''search'', :controller => ''home'' }, :loading => "Element.show(''activity'')", :complete => "Element.hide(''activity''); Element.show(''search-box''); new Effect.SlideDown(''search-box'')" %> <tr> <td><%= image_tag ''activity-black.gif'', :id => ''activity'', :style => ''display:none'' %></td> <td><%= text_field_tag ''term'' %></td> <td><%= image_submit_tag ''/images/search3.gif'' %></td> </tr> <%= end_form_tag %> </table> </div> ..then params is never set. Putting the form tags within the table is a bad habit I picked that probably doesn''t conform to any DOM standards, but it used to fix a weird browser bug that inserted a linebreak after the closing form tags. Ugly HTML or not, I think that the latter should probably work or else there should be a note in the documentation to make your forms DOM compliant if that''s a problem. I''m glad I ran across the original poster''s message or this behavior would have puzzled me for a lot longer than it did. -Pawel -- Posted via http://www.ruby-forum.com/.
Pawel Szymczykowski wrote:> <div id="search-tab"> > <%= form_remote_tag :update => ''search-results'', > :url => { :action => ''search'', :controller => ''home'' },Sorry for the horrible indentation, folks! -Pawel -- Posted via http://www.ruby-forum.com/.
Pawel Szymczykowski wrote:> But if you put the <form></form> tags within the table like the > following: > > <table> > <div id="search-tab"> > <%= form_remote_tag :update => ''search-results'', > :url => { :action => ''search'', :controller => ''home'' }, > :loading => "Element.show(''activity'')", > :complete => "Element.hide(''activity''); > Element.show(''search-box''); new Effect.SlideDown(''search-box'')" %> > <tr> > <td><%= image_tag ''activity-black.gif'', :id => ''activity'', :style > => ''display:none'' %></td> > <td><%= text_field_tag ''term'' %></td> > <td><%= image_submit_tag ''/images/search3.gif'' %></td> > </tr> > <%= end_form_tag %> > </table> > </div> > > ..then params is never set.Instead of using form_remote_tag and a normal submit button, try using submit_to_remote with option :submit => ''search_tab'' -- We develop, watch us RoR, in numbers too big to ignore.
On 1/17/06, Mark Reginald James <mrj@bigpond.net.au> wrote:> > Pawel Szymczykowski wrote: > > Instead of using form_remote_tag and a normal submit button, try using > submit_to_remote with option :submit => ''search_tab'' > > >How do I go about sending multiple form values with the :submit option? It appears you can only send one field through that way. Any thoughts? Thanks! -- Matt Secoske http://www.secosoft.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060202/aa6054e8/attachment.html
Matt Secoske wrote:> How do I go about sending multiple form values with the :submit option? > It appears you can only send one field through that way. Any thoughts?No, all named fields within the div specified in the :submit option will be sent. -- We develop, watch us RoR, in numbers too big to ignore.
Could you provide an example? I am trying to do this: <p><div id="participants_list"> <%= render :action => ''list_participants'' %> </div> Email: <%= text_field ''participant'', ''email'', :size => 20, :maxlength => 255 %> Name: <%= text_field ''participant'', ''name'', :size => 20, :maxlength => 255 %> <br/> <%= submit_to_remote( "add_part_button", "add", {:update => "participants_list", :url => { :action => :add_participant }, :submit => ["participant_email", "participant_name"] }) %> </p> Which results in: <p><div id="participants_list"> </div> Email: <input id="participant_email" maxlength="255" name"participant[email]" size="20" type="text" /> Name: <input id="participant_name" maxlength="255" name="participant[name]" size="20" type="text" /> < br/> <input name="add_part_button" onclick="new Ajax.Updater(''participants_list'', ''/main/add_participant'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(document.getElementById(''participant_emailparticipant_name''))}); return false;" type="button" value="add" /> </p> I also tried: <p><div id="participants_list"> <%= render :action => ''list_participants'' %> </div> Email: <%= text_field ''participant'', ''email'', :size => 20, :maxlength => 255 %> Name: <%= text_field ''participant'', ''name'', :size => 20, :maxlength => 255 %> <br/> <%= submit_to_remote( "add_part_button", "add", {:update => "participants_list", :url => { :action => :add_participant }, :submit => "participant_email" }) %> </p> Which gets me the participant_email element in the controller. So, I know how to get one value, but not two... On a side note, this works fine from a rails perspective, but Firefox (1.5 +) seems to crash whenever I make that submit... anyone else see this? - Matt On 2/2/06, Mark Reginald James < mrj@bigpond.net.au> wrote:> > Matt Secoske wrote: > > > How do I go about sending multiple form values with the :submit option? > > It appears you can only send one field through that way. Any thoughts? > > No, all named fields within the div specified in the :submit option > will be sent. > > -- > We develop, watch us RoR, in numbers too big to ignore. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Matt Secoske http://www.secosoft.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060203/b52d595c/attachment-0001.html
So, I reread your response, slapped my self in the head, and tried submitting by the div id. It works, except that it still crashes Firefox... any ideas on that? Thank you very much! - Matt On 2/3/06, Matt Secoske <secoskem@gmail.com> wrote:> > Could you provide an example? I am trying to do this: > ... >Which gets me the participant_email element in the controller. So, I know> how to get one value, but not two... On a side note, this works fine from a > rails perspective, but Firefox ( 1.5 +) seems to crash whenever I make > that submit... anyone else see this? > > - Matt > > > > On 2/2/06, Mark Reginald James < mrj@bigpond.net.au> wrote: > > > > Matt Secoske wrote: > > > > > How do I go about sending multiple form values with the :submit > > option? > > > It appears you can only send one field through that way. Any > > thoughts? > > > > No, all named fields within the div specified in the :submit option > > will be sent. > > > > -- > > We develop, watch us RoR, in numbers too big to ignore. > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Matt Secoske > http://www.secosoft.net >-- Matt Secoske http://www.secosoft.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060203/209e21bb/attachment.html
Matt Secoske wrote:> So, I reread your response, slapped my self in the head, and tried > submitting by the div id. It works, except that it still crashes > Firefox... any ideas on that?Try updating Prototype using "rake update_javascripts", and ensure you don''t have overlaping divs and other block elements. If Firefox is still crashing, post your final code. -- We develop, watch us RoR, in numbers too big to ignore.
That took care of it. Thanks! On 2/3/06, Mark Reginald James <mrj@bigpond.net.au> wrote:> > Matt Secoske wrote: > > So, I reread your response, slapped my self in the head, and tried > > submitting by the div id. It works, except that it still crashes > > Firefox... any ideas on that? > > Try updating Prototype using "rake update_javascripts", and ensure > you don''t have overlaping divs and other block elements. If Firefox > is still crashing, post your final code. > > -- > We develop, watch us RoR, in numbers too big to ignore. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Matt Secoske http://www.secosoft.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060203/25ddfe5f/attachment-0001.html