Embedding Question Marks in Query Strings

I have an Ajax updater using observe_field:

<%= text_area_tag('ubb', nil, :size => '60x40') %> <%= observe_field(:ubb, :url => {:action => 'render_preview'}, :frequency => 0.5, :update => 'preview', :with => 'ubb') %>

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

On 9/20/07, s.ross [email protected] wrote:

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

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.