Hey,
I have a form on a website that I would like to be submitted remotely
- to not have to reload the whole page. Only the form should update,
so that e.g. error messages can be displayed. Makes sense :)
However, with the current rails.js javascript in Rails 3, the only way
to do this is using
form_for ... :remote => true
and then render a RJS in the controller, which will do... what? Try to
puzzle the form values and error messages into the invalid form?
Instead, I came up with this spontaneous extension to rails.js:
http://gist.github.com/385167
With something as easy as
form_tag ... :html => { ''data-update'' =>
''div_with_the_form_to_be_updated'' }
I can now have the controller render HTML to update the form when it
has errors, and still RJS if I would like to do some fancy stuff in
case the submission was successful.
I assume this feature should be included in rails.js. It would take
just a few lines of smart modification.
In the far future, ActionView might even be modified to implement the
good ol''
form_tag ... :update => ''div_to_be_updated''
I would love to hear your opinion about this.
All the best!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.