Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
event add behavior with form not quite working right...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
patrick  
View profile   Translate to Translated (View Original)
 More options 29 Oct, 08:57
From: patrick <patrick99...@gmail.com>
Date: Thu, 29 Oct 2009 01:57:46 -0700 (PDT)
Local: Thurs 29 Oct 2009 08:57
Subject: event add behavior with form not quite working right...
Hi everyone,

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:

                                        '#photo_search_submit:click': function() {
                                                this.form.request({onComplete:
                                                        function(r) {
                                                                $('container').update(r.responseText);
                                                        }
                                                });

                                        }

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.....

-patrick


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jarkko Laine  
View profile   Translate to Translated (View Original)
 More options 29 Oct, 09:06
From: Jarkko Laine <jar...@jlaine.net>
Date: Thu, 29 Oct 2009 11:06:43 +0200
Local: Thurs 29 Oct 2009 09:06
Subject: Re: event add behavior with form not quite working right...
Hi Patrick,

On 29.10.2009, at 10.57, patrick wrote:

> Hi everyone,

> 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:

>                                    '#photo_search_submit:click': function() {
>                                            this.form.request({onComplete:
>                                                    function(r) {
>                                                            $('container').update(r.responseText);
>                                                    }
>                                            });

>                                    }

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:

Event.addBehavior({
   '#your_form_element' : Remote.Form({
      onComplete : function(r) {
         $('container').update(r.responseText);
      }
    })

});

//jarkko

--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://odesign.fi

Check out my latest book, Unobtrusive Prototype, fresh off the  
Peepcode oven:
http://peepcode.com/products/unobtrusive-prototype-js


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
patrick  
View profile   Translate to Translated (View Original)
 More options 29 Oct, 17:18
From: patrick <patrick99...@gmail.com>
Date: Thu, 29 Oct 2009 10:18:38 -0700 (PDT)
Local: Thurs 29 Oct 2009 17:18
Subject: Re: event add behavior with form not quite working right...
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google