Hi you all I have a form with button tags that represent a uri, so, for example, I have: <input checked=''checked'' id=''#{url}'' name=''#{url}'' type=''radio'' value=''#{value}'' /> Where "url" is a variable containing a URI. The URI appears on the view correctly so, in case of a URI such as http://hello.com/bla+bla, it appears as it is. However, when returning "params" to the controller, the "params" variable has stored the URI as "http://hello.com/bla bla". That is, it has transformed the "+" symbols to spaces. How can I avoid this? I have tried with URI::unescape(url) in the form, but it still transforms the URI. -- 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 -~----------~----~----~----~------~----~------~--~---
> <input checked=''checked'' id=''#{url}'' name=''#{url}'' type=''radio''URIs as id and name attributes! Wow that seems bizarre. I''m not surprised at all that you''re seeing some odd behavior. I''m guessing that it''s to_param method that is doing that to you, but I imagine it''s doing so to try to protect you from yourself. Damaris Fuentes wrote:> Hi you all > > I have a form with button tags that represent a uri, so, for example, I > have: > > <input checked=''checked'' id=''#{url}'' name=''#{url}'' type=''radio'' > value=''#{value}'' /> > > Where "url" is a variable containing a URI. > The URI appears on the view correctly so, in case of a URI such as > http://hello.com/bla+bla, it appears as it is. > However, when returning "params" to the controller, the "params" > variable has stored the URI as "http://hello.com/bla bla". That is, it > has transformed the "+" symbols to spaces. How can I avoid this? I have > tried with URI::unescape(url) in the form, but it still transforms the > URI.-- 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 -~----------~----~----~----~------~----~------~--~---
Um.... :( I have results in a list. These results are web pages, each of them have some radio buttons to say if they like or not that web page. So, the radio buttons have to store those URLs somewhere :( Robert Walker wrote:>> <input checked=''checked'' id=''#{url}'' name=''#{url}'' type=''radio'' > URIs as id and name attributes! Wow that seems bizarre. I''m not > surprised at all that you''re seeing some odd behavior. > > I''m guessing that it''s to_param method that is doing that to you, but I > imagine it''s doing so to try to protect you from yourself. > > Damaris Fuentes wrote: >> Hi you all >> >> I have a form with button tags that represent a uri, so, for example, I >> have: >> >> <input checked=''checked'' id=''#{url}'' name=''#{url}'' type=''radio'' >> value=''#{value}'' /> >> >> Where "url" is a variable containing a URI. >> The URI appears on the view correctly so, in case of a URI such as >> http://hello.com/bla+bla, it appears as it is. >> However, when returning "params" to the controller, the "params" >> variable has stored the URI as "http://hello.com/bla bla". That is, it >> has transformed the "+" symbols to spaces. How can I avoid this? I have >> tried with URI::unescape(url) in the form, but it still transforms the >> URI.-- 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 -~----------~----~----~----~------~----~------~--~---
When I say "they like" i am referring to the users. -- 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 -~----------~----~----~----~------~----~------~--~---
On Wed, Oct 8, 2008 at 9:46 AM, Damaris Fuentes <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have results in a list. These results are web pages, each of them have > some radio buttons to say if they like or not that web page. So, the > radio buttons have to store those URLs somewhere :(Uh, that would be the ''value'' attribute. :-) I''d suggest re-reading the relevant HTML recommendation. For one thing, all radio buttons of a set must share the same name. See: <http://www.w3.org/TR/html401/interact/forms.html#radio> Also, slashes aren''t legal characters for an id or name: <http://www.w3.org/TR/html401/types.html#type-name> FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Um... the value attribute is "Yes", "No", "I don''t care" :), related to the web page on the name of radio button. I will have a look to the links you mention. However, I am not sure I will be able to change this, so I think I will end up encoding the url some way and decoding it in the controller.. Lots of thanks for your help. Hassan Schroeder wrote:> On Wed, Oct 8, 2008 at 9:46 AM, Damaris Fuentes > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> I have results in a list. These results are web pages, each of them have >> some radio buttons to say if they like or not that web page. So, the >> radio buttons have to store those URLs somewhere :( > > Uh, that would be the ''value'' attribute. :-) > > I''d suggest re-reading the relevant HTML recommendation. For one > thing, all radio buttons of a set must share the same name. > > See: <http://www.w3.org/TR/html401/interact/forms.html#radio> > > Also, slashes aren''t legal characters for an id or name: > > <http://www.w3.org/TR/html401/types.html#type-name> > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org-- 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 -~----------~----~----~----~------~----~------~--~---