Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Ruby and the fly likes Rails 3 remote form processing as HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Rails 3 remote form processing as HTML" Watch "Rails 3 remote form processing as HTML" New topic

Rails 3 remote form processing as HTML

agus hendrayana

Joined: Apr 14, 2011
Posts: 4
I'm sure I'm missing something simple. I want to simply update a record in the background without rendering anything or changing the page, but my remote form passes data as HTML, not JS.

In the view:

Then, my JQuery to submit form on change:

In my controller:

When I do this, I get a missing template error:

Because the controller is trying to process it as HTML, not as Javascript. I thought that was what :remote => true was for? If not, what's the point?

So I found I can get around this by explicitly adding :format => :json to my form_for:

But can anyone tell me why I have to do that? What am I missing?


Ruby on Rails Developer :: Php Developer
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Rails 3 remote form processing as HTML
Similar Threads
My form submit is called twice
change event is firing twice
pass value from struts2 form to javascript
help with Prototype
Help with rack-Recaptcha