I have an Ajax updater using observe_field: <form> <%= text_area_tag(''ubb'', nil, :size => ''60x40'') %> <%= observe_field(:ubb, :url => {:action => ''render_preview''}, :frequency => 0.5, :update => ''preview'', :with => ''ubb'') %> </form> <div id="preview"></div> This all works great until the text in the textarea contains a question mark. For example: Can I use a question mark? At which point, it seems not to be submittable using the Ajax helpers because I get nothing in the params hash. Anyone had this problem/found workarounds? Thx About your application''s environment Ruby version 1.8.6 (i686-darwin8.9.1) RubyGems version 0.9.4 Rails version 1.2.3 Active Record version 1.15.3 Action Pack version 1.13.3 Action Web Service version 1.2.3 Active Resource version 0.9.0 Action Mailer version 1.3.3 Active Support version 1.4.2 Edge Rails revision 224 Application root /some/directory/in/a/galaxy/far/far/away Environment development Database adapter mysql Database schema version 8 --~--~---------~--~----~------------~-------~--~----~ 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 9/20/07, s.ross <cwdinfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have an Ajax updater using observe_field: > > <form> > <%= text_area_tag(''ubb'', nil, :size => ''60x40'') %> > <%= observe_field(:ubb, :url => {:action => > ''render_preview''}, :frequency => 0.5, :update => ''preview'', :with => > ''ubb'') %> > </form> > <div id="preview"></div> > > This all works great until the text in the textarea contains a > question mark. For example: > > Can I use a question mark? > > At which point, it seems not to be submittable using the Ajax helpers > because I get nothing in the params hash. > > Anyone had this problem/found workarounds?This is discussed in detail at: http://wiki.rubyonrails.org/rails/pages/observe_field+-+Passing+Parameters --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So it is... Thanks. In case anyone else runs into this, if you expect any non-URL-safe characters in your Ajax request, use this: :with => "''text='' + encodeURIComponent($(''myfield'').value)" in your observe_field method call. Out of the box, all characters are passed through unmodified. On Sep 20, 2007, at 12:52 PM, Bob Showalter wrote:> > On 9/20/07, s.ross <cwdinfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> I have an Ajax updater using observe_field: >> >> <form> >> <%= text_area_tag(''ubb'', nil, :size => ''60x40'') %> >> <%= observe_field(:ubb, :url => {:action => >> ''render_preview''}, :frequency => 0.5, :update => ''preview'', :with => >> ''ubb'') %> >> </form> >> <div id="preview"></div> >> >> This all works great until the text in the textarea contains a >> question mark. For example: >> >> Can I use a question mark? >> >> At which point, it seems not to be submittable using the Ajax helpers >> because I get nothing in the params hash. >> >> Anyone had this problem/found workarounds? > > This is discussed in detail at: > > http://wiki.rubyonrails.org/rails/pages/observe_field+-+Passing > +Parameters > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---