I hope this group is still active as it looks like the majority of
posts are spam... Anyway, I have a form with a submit button and I am
using Event.addBehavior to send it remotely:
my controller action is just doing render :partial => 'some_file' --
which gives the text to update the container..
It works fine the first time I click the submit button, however, the
2nd time I click it, the form is submitted as a regular http
request.. I don't understand why, and I am already doing:
Event.addBehavior.reassignAfterAjax = true;
However, maybe that doesn't work with this.form.request.....
> I hope this group is still active as it looks like the majority of > posts are spam... Anyway, I have a form with a submit button and I am > using Event.addBehavior to send it remotely:
Why not just assign Remote.Form to the form in question? You can pass an onComplete parameter to it as well. Not sure whether it solves your problem but at least it makes the code a bit cleaner:
Yeah that does make more sense--- I just wasn't sure how to do that..
Thanks for pointing that out.
One other question I have... I have been eliminating my usage of .rjs
files in my rails app because it seemed like they weren't really
necessary, and the same thing could be accomplished (page updates,
effects etc) from the onComplete of ajax calls... However, I am
unclear about how to handle the fact if I want to update two different
elements on a page with two different partials?
As I demonstrated in my code, my controller actions render a partial
that js uses the response text to update an element. How can I render
two partials and update two elements this way? Or is rjs really the
best solution for this problem?
-patrick
On 29 Oct, 02:06, Jarkko Laine <jar...@jlaine.net> wrote:
> > I hope this group is still active as it looks like the majority of
> > posts are spam... Anyway, I have a form with a submit button and I am
> > using Event.addBehavior to send it remotely:
> Why not just assign Remote.Form to the form in question? You can pass
> an onComplete parameter to it as well. Not sure whether it solves your
> problem but at least it makes the code a bit cleaner: