You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ma...@bmw.ch on 2007/05/09 13:02:07 UTC
dirty form checking ...
I'm implementing a dirty form checking component.
Can I avoid the dreaded window.onbeforeunload and use some convenient
dojo-hook to upon unloading the form?
Any ideas are welcome!
thanks, Marcus
Re: dirty form checking ...
Posted by andyhot <an...@di.uoa.gr>.
Jesse recently fixed
https://issues.apache.org/jira/browse/TAPESTRY-1245
Did you get a chance to try the dirty form checker again?
Marcus.Schulte@bmw.ch wrote:
> Ok, now I got it right, almost ;).
>
> Somehow tapestry tapestry.form.onFormSubmit is not called, when you use
> tapestry.form.submit to submit the form, as @LinkSubmit does.
> So I ended up with two connections for the defuser:
>
> dojo.event.connect("before", tapestry.form ,"onFormSubmit",
> tapestry.dirtyFormWarning,
> "defuse");
> dojo.event.connect("around", tapestry.form,"submit",
> tapestry.dirtyFormWarning,
> "defuseAround");
>
> Now, this works fine for FF out of the box. However there's an
> issue with (surprise, surprise) IE, which fires onbeforeunload
> twice under certain circumstances, the first time being before
> one has a chance to defuse the warning component. Afaik, this
> occurs only with the <a href="javascript:someFunc()"> idiom as
> it is used in @LinkSubmit. I have therefore in our app replaced
> @LinkSubmit with an equivalent component whiche renders
> <a href="#" onclick="tapestry.form.submit(...)" >...
> instead of
> <a href="javascript:tapestry.form.submit(...)" > ...
>
> So, for this component to be useful for Tacos, tapestry's
> LinkSubmit would have to be changed accordingly.
> Andy has already submitted a jira for this, I see:
>
> https://issues.apache.org/jira/browse/TAPESTRY-1245
>
> regards,
> Marcus
>
>
>
>> Ok, I tried
>> dojo.event.connect( tapestry.form
>> ,"onFormSubmit",tapestry.dirtyFormWarning, "defuse"); now,
>> same result: works for @Submit, doesn't work for @LinkSubmit ...
>>
>>
>>
>>> -----Original Message-----
>>> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
>>> Sent: Wednesday, May 09, 2007 5:52 PM
>>> To: Tapestry users
>>> Subject: Re: dirty form checking ...
>>>
>>> I think you can connect to tapestry.form.onFormSubmit as per:
>>>
>>> http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry
>>> -framework/src/js/tapestry/form.js?view=markup
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: dirty form checking ...
Posted by Ma...@bmw.ch.
Ok, now I got it right, almost ;).
Somehow tapestry tapestry.form.onFormSubmit is not called, when you use
tapestry.form.submit to submit the form, as @LinkSubmit does.
So I ended up with two connections for the defuser:
dojo.event.connect("before", tapestry.form ,"onFormSubmit",
tapestry.dirtyFormWarning,
"defuse");
dojo.event.connect("around", tapestry.form,"submit",
tapestry.dirtyFormWarning,
"defuseAround");
Now, this works fine for FF out of the box. However there's an
issue with (surprise, surprise) IE, which fires onbeforeunload
twice under certain circumstances, the first time being before
one has a chance to defuse the warning component. Afaik, this
occurs only with the <a href="javascript:someFunc()"> idiom as
it is used in @LinkSubmit. I have therefore in our app replaced
@LinkSubmit with an equivalent component whiche renders
<a href="#" onclick="tapestry.form.submit(...)" >...
instead of
<a href="javascript:tapestry.form.submit(...)" > ...
So, for this component to be useful for Tacos, tapestry's
LinkSubmit would have to be changed accordingly.
Andy has already submitted a jira for this, I see:
https://issues.apache.org/jira/browse/TAPESTRY-1245
regards,
Marcus
>
> Ok, I tried
> dojo.event.connect( tapestry.form
> ,"onFormSubmit",tapestry.dirtyFormWarning, "defuse"); now,
> same result: works for @Submit, doesn't work for @LinkSubmit ...
>
>
> > -----Original Message-----
> > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > Sent: Wednesday, May 09, 2007 5:52 PM
> > To: Tapestry users
> > Subject: Re: dirty form checking ...
> >
> > I think you can connect to tapestry.form.onFormSubmit as per:
> >
> > http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry
> > -framework/src/js/tapestry/form.js?view=markup
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: dirty form checking ...
Posted by Ma...@bmw.ch.
Ok, I tried
dojo.event.connect( tapestry.form
,"onFormSubmit",tapestry.dirtyFormWarning, "defuse");
now, same result: works for @Submit, doesn't work for @LinkSubmit ...
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Wednesday, May 09, 2007 5:52 PM
> To: Tapestry users
> Subject: Re: dirty form checking ...
>
> I think you can connect to tapestry.form.onFormSubmit as per:
>
> http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry
> -framework/src/js/tapestry/form.js?view=markup
>
> On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> >
> > Yes, that's what I started with.
> > The basic check works, now. But I can't seem to hook into regular
> > form-submission nicely, to switch off the dirty-check in that case.
> > I tried
> >
> >
> dojo.event.connect(form_${formName},"onsubmit",tapestry.dirtyFormWarni
> > ng
> > , "defuse");
> >
> > That works just fine for @Submit, but not at all for
> @LinkSubmit ... .
> >
> > > -----Original Message-----
> > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > Sent: Wednesday, May 09, 2007 3:53 PM
> > > To: Tapestry users
> > > Subject: Re: dirty form checking ...
> > >
> > > Oh ...Forgot that you wanted to stop it. Yeah that wouldn't work
> > > there.
> > >
> > > I don't think there is anything to do other than what tacos does:
> > >
> > > http://opencomponentry.com:8080/tacos/forms/DirtyFormExample.html
> > >
> > > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > >
> > > > thanks, but I don't seem to be able to veto that event.
> > > > dojo.event.browser.stopEvent(evt) doesn't seem to work ...
> > > >
> > > > > -----Original Message-----
> > > > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > > > Sent: Wednesday, May 09, 2007 2:57 PM
> > > > > To: Tapestry users
> > > > > Subject: Re: dirty form checking ...
> > > > >
> > > > > dojo.addOnUnload
> > > > >
> > > > > On 5/9/07, Marcus.Schulte@bmw.ch
> <Ma...@bmw.ch> wrote:
> > > > > >
> > > > > > I'm implementing a dirty form checking component.
> > > > > >
> > > > > > Can I avoid the dreaded window.onbeforeunload and use some
> > > > > convenient
> > > > > > dojo-hook to upon unloading the form?
> > > > > >
> > > > > > Any ideas are welcome!
> > > > > >
> > > > > > thanks, Marcus
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jesse Kuhnert
> > > > > Tapestry/Dojo team member/developer
> > > > >
> > > > > Open source based consulting work centered around
> > > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > > >
> > > >
> > > >
> > >
> --------------------------------------------------------------------
> > > -
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: dirty form checking ...
Posted by Ma...@bmw.ch.
> And hey, if that works, perhaps contribute back into tacos?
>
> i'm sure we'll have to implement that eventually, so it'll be
> a huge shortcut if we could use that!
sure, if I ever make it work ... :(
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: dirty form checking ...
Posted by Andreas Andreou <an...@di.uoa.gr>.
And hey, if that works, perhaps contribute back into tacos?
i'm sure we'll have to implement that eventually, so it'll be a huge
shortcut
if we could use that!
On 5/9/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> I think you can connect to tapestry.form.onFormSubmit as per:
>
>
> http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=markup
>
> On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> >
> > Yes, that's what I started with.
> > The basic check works, now. But I can't seem to hook into regular
> > form-submission nicely, to switch
> > off the dirty-check in that case.
> > I tried
> >
> > dojo.event.connect(form_${formName},"onsubmit",tapestry.dirtyFormWarning
> > , "defuse");
> >
> > That works just fine for @Submit, but not at all for @LinkSubmit ... .
> >
> > > -----Original Message-----
> > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > Sent: Wednesday, May 09, 2007 3:53 PM
> > > To: Tapestry users
> > > Subject: Re: dirty form checking ...
> > >
> > > Oh ...Forgot that you wanted to stop it. Yeah that wouldn't
> > > work there.
> > >
> > > I don't think there is anything to do other than what tacos does:
> > >
> > > http://opencomponentry.com:8080/tacos/forms/DirtyFormExample.html
> > >
> > > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > >
> > > > thanks, but I don't seem to be able to veto that event.
> > > > dojo.event.browser.stopEvent(evt) doesn't seem to work ...
> > > >
> > > > > -----Original Message-----
> > > > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > > > Sent: Wednesday, May 09, 2007 2:57 PM
> > > > > To: Tapestry users
> > > > > Subject: Re: dirty form checking ...
> > > > >
> > > > > dojo.addOnUnload
> > > > >
> > > > > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > > > >
> > > > > > I'm implementing a dirty form checking component.
> > > > > >
> > > > > > Can I avoid the dreaded window.onbeforeunload and use some
> > > > > convenient
> > > > > > dojo-hook to upon unloading the form?
> > > > > >
> > > > > > Any ideas are welcome!
> > > > > >
> > > > > > thanks, Marcus
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jesse Kuhnert
> > > > > Tapestry/Dojo team member/developer
> > > > >
> > > > > Open source based consulting work centered around
> > > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > > >
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
--
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting
Re: dirty form checking ...
Posted by Jesse Kuhnert <jk...@gmail.com>.
I think you can connect to tapestry.form.onFormSubmit as per:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=markup
On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> Yes, that's what I started with.
> The basic check works, now. But I can't seem to hook into regular
> form-submission nicely, to switch
> off the dirty-check in that case.
> I tried
>
> dojo.event.connect(form_${formName},"onsubmit",tapestry.dirtyFormWarning
> , "defuse");
>
> That works just fine for @Submit, but not at all for @LinkSubmit ... .
>
> > -----Original Message-----
> > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > Sent: Wednesday, May 09, 2007 3:53 PM
> > To: Tapestry users
> > Subject: Re: dirty form checking ...
> >
> > Oh ...Forgot that you wanted to stop it. Yeah that wouldn't
> > work there.
> >
> > I don't think there is anything to do other than what tacos does:
> >
> > http://opencomponentry.com:8080/tacos/forms/DirtyFormExample.html
> >
> > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > >
> > > thanks, but I don't seem to be able to veto that event.
> > > dojo.event.browser.stopEvent(evt) doesn't seem to work ...
> > >
> > > > -----Original Message-----
> > > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > > Sent: Wednesday, May 09, 2007 2:57 PM
> > > > To: Tapestry users
> > > > Subject: Re: dirty form checking ...
> > > >
> > > > dojo.addOnUnload
> > > >
> > > > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > > >
> > > > > I'm implementing a dirty form checking component.
> > > > >
> > > > > Can I avoid the dreaded window.onbeforeunload and use some
> > > > convenient
> > > > > dojo-hook to upon unloading the form?
> > > > >
> > > > > Any ideas are welcome!
> > > > >
> > > > > thanks, Marcus
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Jesse Kuhnert
> > > > Tapestry/Dojo team member/developer
> > > >
> > > > Open source based consulting work centered around
> > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: dirty form checking ...
Posted by Ma...@bmw.ch.
Yes, that's what I started with.
The basic check works, now. But I can't seem to hook into regular
form-submission nicely, to switch
off the dirty-check in that case.
I tried
dojo.event.connect(form_${formName},"onsubmit",tapestry.dirtyFormWarning
, "defuse");
That works just fine for @Submit, but not at all for @LinkSubmit ... .
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Wednesday, May 09, 2007 3:53 PM
> To: Tapestry users
> Subject: Re: dirty form checking ...
>
> Oh ...Forgot that you wanted to stop it. Yeah that wouldn't
> work there.
>
> I don't think there is anything to do other than what tacos does:
>
> http://opencomponentry.com:8080/tacos/forms/DirtyFormExample.html
>
> On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> >
> > thanks, but I don't seem to be able to veto that event.
> > dojo.event.browser.stopEvent(evt) doesn't seem to work ...
> >
> > > -----Original Message-----
> > > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > > Sent: Wednesday, May 09, 2007 2:57 PM
> > > To: Tapestry users
> > > Subject: Re: dirty form checking ...
> > >
> > > dojo.addOnUnload
> > >
> > > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > > >
> > > > I'm implementing a dirty form checking component.
> > > >
> > > > Can I avoid the dreaded window.onbeforeunload and use some
> > > convenient
> > > > dojo-hook to upon unloading the form?
> > > >
> > > > Any ideas are welcome!
> > > >
> > > > thanks, Marcus
> > > >
> > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: dirty form checking ...
Posted by Jesse Kuhnert <jk...@gmail.com>.
Oh ...Forgot that you wanted to stop it. Yeah that wouldn't work there.
I don't think there is anything to do other than what tacos does:
http://opencomponentry.com:8080/tacos/forms/DirtyFormExample.html
On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> thanks, but I don't seem to be able to veto that event.
> dojo.event.browser.stopEvent(evt) doesn't seem to work ...
>
> > -----Original Message-----
> > From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> > Sent: Wednesday, May 09, 2007 2:57 PM
> > To: Tapestry users
> > Subject: Re: dirty form checking ...
> >
> > dojo.addOnUnload
> >
> > On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> > >
> > > I'm implementing a dirty form checking component.
> > >
> > > Can I avoid the dreaded window.onbeforeunload and use some
> > convenient
> > > dojo-hook to upon unloading the form?
> > >
> > > Any ideas are welcome!
> > >
> > > thanks, Marcus
> > >
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: dirty form checking ...
Posted by Ma...@bmw.ch.
thanks, but I don't seem to be able to veto that event.
dojo.event.browser.stopEvent(evt) doesn't seem to work ...
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Wednesday, May 09, 2007 2:57 PM
> To: Tapestry users
> Subject: Re: dirty form checking ...
>
> dojo.addOnUnload
>
> On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
> >
> > I'm implementing a dirty form checking component.
> >
> > Can I avoid the dreaded window.onbeforeunload and use some
> convenient
> > dojo-hook to upon unloading the form?
> >
> > Any ideas are welcome!
> >
> > thanks, Marcus
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: dirty form checking ...
Posted by Jesse Kuhnert <jk...@gmail.com>.
dojo.addOnUnload
On 5/9/07, Marcus.Schulte@bmw.ch <Ma...@bmw.ch> wrote:
>
> I'm implementing a dirty form checking component.
>
> Can I avoid the dreaded window.onbeforeunload and use some convenient
> dojo-hook to upon unloading the form?
>
> Any ideas are welcome!
>
> thanks, Marcus
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com