File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rails 3 remote form processing as HTML

 
agus hendrayana
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic