Jeremy Durham

Ruby, Rails, and everything in between.

  • BlogThoughts
  • AboutAbout the Author
  • ContactGet in touch

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"} @

No Comments

Posted Under Programming

  • Posts
  • Twitter
  • Flickr
 

There is no Holy ...

Technology

 

Google and Apple:...

Technology

 

Setting up Git an...

Technology

@mariusrugan awesome, glad I was able to be of some help

follow me on
twitter

125942640_a3dcc3f951_s125942637_c4524c7c88_s125942628_a682f8a639_s122144184_5f2dd86929_s122144182_1b01ded312_s122144181_893a82f1d3_s122144179_70465b00ff_s122102402_21e6174af6_s122102401_f6d9ebff55_s

Categories

  • Technology
  • Programming
  • Family
  • Travel

This site is using the Handgloves WordPress Theme
Designed & Developed by George Wiscombe

Subscribe via RSS