I'm using addBehavior to convert a number of form elements on a page
to use an AJAX request but when onSuccess is called there is no way
(that I can tell) to work out which form it was. Because the form
issues a backend delete, Ideally I'd like the client to remove the
form from the page.
Event.addBehavior({
"form.delete": Remote.Form({
onSuccess: function() {
// Now I want to remove the form element but I can't
}
})
Hmm...I had tried that but I tried it again anyway and got the same
results: "this" is a [object DOMWindow] and "this.element" is
undefined. I presume because the onSuccess event is triggered by the
Ajax.Request?
On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:
Oh sorry, I didn't read your example properly. At the moment you can't set *Ajax.Request* event handlers via the behavior only *element* event handlers. Im working on it in the trunk but its not finished yet.
On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> Hmm...I had tried that but I tried it again anyway and got the same > results: "this" is a [object DOMWindow] and "this.element" is > undefined. I presume because the onSuccess event is triggered by the > Ajax.Request?
> On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote: > > > Event.addBehavior({ > > > "form.delete": Remote.Form({ > > > onSuccess: function() { > > > // Now I want to remove the form element but I can't
The event definitely gets fired and I have access to the response as I
would expect I just can't get at the Behaviour (as you stated). I
might just have to work around it for the time being by overriding
_makeRequest unless you can think of a better option?
On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote:
> Oh sorry, I didn't read your example properly. At the moment you
> can't set *Ajax.Request* event handlers via the behavior only
> *element* event handlers. Im working on it in the trunk but its not
> finished yet.
> On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > Hmm...I had tried that but I tried it again anyway and got the same
> > results: "this" is a [object DOMWindow] and "this.element" is
> > undefined. I presume because the onSuccess event is triggered by the
> > Ajax.Request?
> > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:
> > > > Event.addBehavior({
> > > > "form.delete": Remote.Form({
> > > > onSuccess: function() {
> > > > // Now I want to remove the form element but I can't
> The event definitely gets fired and I have access to the response as I > would expect I just can't get at the Behaviour (as you stated). I > might just have to work around it for the time being by overriding > _makeRequest unless you can think of a better option?
> On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote: > > Oh sorry, I didn't read your example properly. At the moment you > > can't set *Ajax.Request* event handlers via the behavior only > > *element* event handlers. Im working on it in the trunk but its not > > finished yet.
> > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > Hmm...I had tried that but I tried it again anyway and got the same > > > results: "this" is a [object DOMWindow] and "this.element" is > > > undefined. I presume because the onSuccess event is triggered by the > > > Ajax.Request?
> > > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote: > > > > > Event.addBehavior({ > > > > > "form.delete": Remote.Form({ > > > > > onSuccess: function() { > > > > > // Now I want to remove the form element but I can't
> When the work is complete this will refer to the behavior instance.
> I'll get it finished soon. Bear with me....in fact, I'll do it now :)
> On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > The event definitely gets fired and I have access to the response as I
> > would expect I just can't get at the Behaviour (as you stated). I
> > might just have to work around it for the time being by overriding
> > _makeRequest unless you can think of a better option?
> > On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote:
> > > Oh sorry, I didn't read your example properly. At the moment you
> > > can't set *Ajax.Request* event handlers via the behavior only
> > > *element* event handlers. Im working on it in the trunk but its not
> > > finished yet.
> > > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > > Hmm...I had tried that but I tried it again anyway and got the same
> > > > results: "this" is a [object DOMWindow] and "this.element" is
> > > > undefined. I presume because the onSuccess event is triggered by the
> > > > Ajax.Request?
> > > > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:
> > > > > > Event.addBehavior({
> > > > > > "form.delete": Remote.Form({
> > > > > > onSuccess: function() {
> > > > > > // Now I want to remove the form element but I can't
> You bloody legend! I'm certainly intrigued to see how you worked the > magic!
> On 19 Mar, 21:58, "Dan Webb" <d...@danwebb.net> wrote: > > When the work is complete this will refer to the behavior instance. > > I'll get it finished soon. Bear with me....in fact, I'll do it now :)
> > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > The event definitely gets fired and I have access to the response as I > > > would expect I just can't get at the Behaviour (as you stated). I > > > might just have to work around it for the time being by overriding > > > _makeRequest unless you can think of a better option?
> > > On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote: > > > > Oh sorry, I didn't read your example properly. At the moment you > > > > can't set *Ajax.Request* event handlers via the behavior only > > > > *element* event handlers. Im working on it in the trunk but its not > > > > finished yet.
> > > > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > > > Hmm...I had tried that but I tried it again anyway and got the same > > > > > results: "this" is a [object DOMWindow] and "this.element" is > > > > > undefined. I presume because the onSuccess event is triggered by the > > > > > Ajax.Request?
> > > > > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote: > > > > > > > Event.addBehavior({ > > > > > > > "form.delete": Remote.Form({ > > > > > > > onSuccess: function() { > > > > > > > // Now I want to remove the form element but I can't
> On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > You bloody legend! I'm certainly intrigued to see how you worked the
> > magic!
> > On 19 Mar, 21:58, "Dan Webb" <d...@danwebb.net> wrote:
> > > When the work is complete this will refer to the behavior instance.
> > > I'll get it finished soon. Bear with me....in fact, I'll do it now :)
> > > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > > The event definitely gets fired and I have access to the response as I
> > > > would expect I just can't get at the Behaviour (as you stated). I
> > > > might just have to work around it for the time being by overriding
> > > > _makeRequest unless you can think of a better option?
> > > > On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote:
> > > > > Oh sorry, I didn't read your example properly. At the moment you
> > > > > can't set *Ajax.Request* event handlers via the behavior only
> > > > > *element* event handlers. Im working on it in the trunk but its not
> > > > > finished yet.
> > > > > > Hmm...I had tried that but I tried it again anyway and got the same
> > > > > > results: "this" is a [object DOMWindow] and "this.element" is
> > > > > > undefined. I presume because the onSuccess event is triggered by the
> > > > > > Ajax.Request?
> > > > > > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:
> > > > > > > > Event.addBehavior({
> > > > > > > > "form.delete": Remote.Form({
> > > > > > > > onSuccess: function() {
> > > > > > > > // Now I want to remove the form element but I can't
I wanted to intercept on404 which wasn't in the list of callbacks so I
implemented onFailure and checked for response.status == 404. It'd be
nice to be able to implement the onNNN callbacks though. The simplest
approach I guess would be to just add every single one of them to the
on list. In my case I just add on404:
> > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > You bloody legend! I'm certainly intrigued to see how you worked the
> > > magic!
> > > On 19 Mar, 21:58, "Dan Webb" <d...@danwebb.net> wrote:
> > > > When the work is complete this will refer to the behavior instance.
> > > > I'll get it finished soon. Bear with me....in fact, I'll do it now :)
> > > > On 3/19/08, Haruki Zaemon <haruki_zae...@mac.com> wrote:
> > > > > The event definitely gets fired and I have access to the response as I
> > > > > would expect I just can't get at the Behaviour (as you stated). I
> > > > > might just have to work around it for the time being by overriding
> > > > > _makeRequest unless you can think of a better option?
> > > > > On 19 Mar, 21:49, "Dan Webb" <d...@danwebb.net> wrote:
> > > > > > Oh sorry, I didn't read your example properly. At the moment you
> > > > > > can't set *Ajax.Request* event handlers via the behavior only
> > > > > > *element* event handlers. Im working on it in the trunk but its not
> > > > > > finished yet.
> > > > > > > Hmm...I had tried that but I tried it again anyway and got the same
> > > > > > > results: "this" is a [object DOMWindow] and "this.element" is
> > > > > > > undefined. I presume because the onSuccess event is triggered by the
> > > > > > > Ajax.Request?
> > > > > > > On 19 Mar, 18:47, "Dan Webb" <d...@danwebb.net> wrote:
> > > > > > > > > Event.addBehavior({
> > > > > > > > > "form.delete": Remote.Form({
> > > > > > > > > onSuccess: function() {
> > > > > > > > > // Now I want to remove the form element but I can't