hi i have a weird problem: this is my view: <tr> <%= start_form_tag :action => ''new_beschikbaarheid'', :behandelaar_id =>@behandelaar, :year => @year%> <td>behandelaar</td><td><%= collection_select("behandelaar",''id'',Behandelaar.find(:all),:id,:naam) %> <%= submit_tag ''Opzoeken'' %> </td> <%= end_form_tag %> when i hit the submit button i get this url: http://localhost:3000/admin/new_beschikbaarheid?behandelaar_id=1&year=2006 where does the amp sign come from and better: how can i get rid of it: i sure hope someone can help me, i don''t know what to do anymore.... Regards, Remco -- 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 -~----------~----~----~----~------~----~------~--~---
i''m not sure of the details but i believe (just a hunch) the answer lies within the notorious ''h'' - a protector for html code... search rails for h sorry for not being more informative, maybe someone else out there can give u more specifics. . . -- 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 -~----------~----~----~----~------~----~------~--~---
thanks for trying, unfortunately it doesn''t help harp wrote:> i''m not sure of the details but i believe (just a hunch) the answer lies > within the notorious ''h'' - a protector for html code... > > search rails for > > h > > sorry for not being more informative, maybe someone else out there can > give u more specifics. . .-- 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 -~----------~----~----~----~------~----~------~--~---
Remco Hh wrote:> hi i have a weird problem: > > this is my view: > <tr> > <%= start_form_tag :action => ''new_beschikbaarheid'', :behandelaar_id > =>@behandelaar, :year => @year%> > <td>behandelaar</td><td><%> collection_select("behandelaar",''id'',Behandelaar.find(:all),:id,:naam) > %> > <%= submit_tag ''Opzoeken'' %> > </td> > <%= end_form_tag %> > > when i hit the submit button i get this url: > > http://localhost:3000/admin/new_beschikbaarheid?behandelaar_id=1&year=2006 > > where does the amp sign come from and better: how can i get rid of it: > i sure hope someone can help me, i don''t know what to do anymore....This is a known problem with some of the tag helpers that handle URLs -- they double-escape the URL so that & becomes &amp; instead of just & in the HTML. I''ve written a patch to fix this, but it''s not been accepted yet: http://dev.rubyonrails.org/ticket/5928 In the meantime you could work around it with some ugly code like this: <form action="<%= url_for(:action => ''new_beschikbaarheid'', :behandelaar_id> =>@behandelaar, :year => @year) %>">Alternatively you could write yourself a custom route so that the generated URL doesn''t contain any ampersands: map.connect '':controller/new_beschikbaarheid/:behandellar_id/:year'' or something like that. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chris Mear wrote:> In the meantime you could work around it with some ugly code like this: > > <form action="<%= url_for(:action => ''new_beschikbaarheid'', > :behandelaar_id > > =>@behandelaar, :year => @year) %>">Google Groups ate my code! But you get the idea -- just manually write the form tag, and call url_for to write the action attribute. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Remco Hh wrote: > > hi i have a weird problem:<...>> > when i hit the submit button i get this url: > > > > http://localhost:3000/admin/new_beschikbaarheid?behandelaar_id=1&year=2006Chris Mear: <...>> In the meantime you could work around it with some ugly code like this: > > <form action="<%= url_for(:action => ''new_beschikbaarheid'', > :behandelaar_id > > =>@behandelaar, :year => @year) %>"> > > Alternatively you could write yourself a custom route so that the > generated URL doesn''t contain any ampersands: > > map.connect '':controller/new_beschikbaarheid/:behandellar_id/:year'' > > or something like that.This bug should be fixed, but I''d suggest not to mix GET and POST (default) methods anyway. You can use hidden fields for additional parameters: <tr> <%= start_form_tag :action => ''new_beschikbaarheid''%> <%= hidden_field_tag :behandelaar_id, @behandelaar %> <%= hidden_field_tag :year, @year %> <td>behandelaar</td><td><%collection_select("behandelaar",''id'',Behandelaar.find(:all),:id,:naam) %> <%= submit_tag ''Opzoeken'' %> </td> <%= end_form_tag %> Regards, Rimantas -- http://rimantas.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 -~----------~----~----~----~------~----~------~--~---
Rimantas Liubertas wrote:> I''d suggest not to mix GET and POST > (default) methods anyway. You can use hidden fields for additional > parameters:You''re not mixing GET and POST; you''re just POSTing to a URL that happens to have some querystring parameters. And, with Rails'' routes, the difference between /user/edit/1 and user/edit?id=1 is pretty slender. They both end up as params[:id] = 1. So every time you submit a form to /user/edit/1 (which is standard practice in Rails), you''re effectively POSTing to a URL with querystring parameters; it''s just that routing hides the ugliness of ?s, =s and &s. Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Rimantas Liubertas wrote: > > > I''d suggest not to mix GET and POST > > (default) methods anyway. You can use hidden fields for additional > > parameters: > > You''re not mixing GET and POST; you''re just POSTing to a URL that > happens to have some querystring parameters. And, with Rails'' routes, > the difference betweenMy bad, I should have said "I''d suggest to avoid passing parameters in url with POST" :) Regards, Rimantas -- http://rimantas.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 -~----------~----~----~----~------~----~------~--~---
i just did this def url_for(options = {}, *parameters_for_method_reference) if options.kind_of? Hash options = { :only_path => true }.update(options.symbolize_keys) escape = options.key?(:escape) ? options.delete(:escape) : true else escape = true end url = @controller.send(:url_for, options, *parameters_for_method_reference) escape ? html_escape(url).gsub(/&/,"&") : url # replaces the ''&'' with its original & end Aryk -- 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 -~----------~----~----~----~------~----~------~--~---