January 09, 2006 08:16
Posted by Jeremy Durham
observe_field and request.raw_post
A few applications I’ve been a part of have use an observe_field for product description previews, or even my blog (to allow me to preview my posts). If I ever work on this site, comment preview will probably use observe_field.
Anyways, I always just used request.raw_post in the controller to catch the posted data and process it. You can use the :with option in observe_field to pass it as a normal param. :with works like this:
<%= observe_field "product_description",:frequency => 2,:update => "preview",:complete => "Element.show('preview')",:url => { :action => "preview" },:with => "'q='+escape(value)" %>
Your params will look something like this:
@ {"action"=>"preview", “q”=>"whateveryoutyped", “controller”=>"products"} @








