Re: Prevent double submission w/linkSubmit

2010-12-10 Thread Josh Canfield
I haven't spent a ton of time thinking about your specific problem, or
why you can't disable the link, but it reminded me of an old thread
about canceling link submits.

http://tapestry.1045711.n5.nabble.com/quot-Confirm-quot-mixin-won-t-cancel-when-in-zone-td2436465.html

If you can't disable the link then maybe you can just ignore the clicks.

Josh


On Fri, Dec 10, 2010 at 11:43 AM, David Rees  wrote:
> On Thu, Dec 9, 2010 at 2:57 PM, Benny Law  wrote:
>> Keep in mind that a form could be submitted by pressing the Enter key inside
>> a text field. A safer approach would be to prevent the form itself from
>> being submitted more than once, regardless of how it is submitted.
>
> Right - and as I stated in my original post I tried disabling the link
> by observing the FORM_PREPARE_FOR_SUBMIT_EVENT event - but for some
> reason you can't disable the link like you can a button...
>
> I also tried using a Javascript variable to see if the form had been
> submitted once already or not, but I was not able to get the event to
> stop...
>
> -Dave
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Prevent double submission w/linkSubmit

2010-12-10 Thread Benny Law
Instead of trying to disable every element that can trigger a form
submission, I stop the form submission event itself. Here is the JavaScript
I have been using, and it seems to be working for me:

document.observe("dom:loaded", function() {
$$("form").invoke("observe", "submit", function(event) {
if (this.submitted) {
event.stop();
} else {
this.submitted = true;
};
});
});

Benny


On Fri, Dec 10, 2010 at 2:43 PM, David Rees  wrote:

> On Thu, Dec 9, 2010 at 2:57 PM, Benny Law  wrote:
> > Keep in mind that a form could be submitted by pressing the Enter key
> inside
> > a text field. A safer approach would be to prevent the form itself from
> > being submitted more than once, regardless of how it is submitted.
>
> Right - and as I stated in my original post I tried disabling the link
> by observing the FORM_PREPARE_FOR_SUBMIT_EVENT event - but for some
> reason you can't disable the link like you can a button...
>
> I also tried using a Javascript variable to see if the form had been
> submitted once already or not, but I was not able to get the event to
> stop...
>
> -Dave
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Prevent double submission w/linkSubmit

2010-12-10 Thread David Rees
On Thu, Dec 9, 2010 at 2:57 PM, Benny Law  wrote:
> Keep in mind that a form could be submitted by pressing the Enter key inside
> a text field. A safer approach would be to prevent the form itself from
> being submitted more than once, regardless of how it is submitted.

Right - and as I stated in my original post I tried disabling the link
by observing the FORM_PREPARE_FOR_SUBMIT_EVENT event - but for some
reason you can't disable the link like you can a button...

I also tried using a Javascript variable to see if the form had been
submitted once already or not, but I was not able to get the event to
stop...

-Dave

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Prevent double submission w/linkSubmit

2010-12-09 Thread Benny Law
Keep in mind that a form could be submitted by pressing the Enter key inside
a text field. A safer approach would be to prevent the form itself from
being submitted more than once, regardless of how it is submitted.

Benny

2010/12/9 françois facon 

> Hi David
>
> about stopping the event.
> did you try to implement a mixin like  clickonce?
>
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
>
> François
>
>
> 2010/12/4 David Rees 
>
> > I'm having problems figuring out how to prevent double clicks with a
> > linkSubmit.
> >
> > With a regular submit, you can just disable the submit button after
> > observing a FORM_PREPARE_FOR_SUBMIT_EVENT, but this doesn't seem to
> > work for a linkSubmit element.
> >
> > Using T5.1.0.8-SNAPSHOT.
> >
> > Any ideas?  Have also tried stopping the event but that doesn't seem
> > to do anything.
> >
> > -Dave
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: Prevent double submission w/linkSubmit

2010-12-09 Thread françois facon
Hi David

about stopping the event.
did you try to implement a mixin like  clickonce?
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1

François


2010/12/4 David Rees 

> I'm having problems figuring out how to prevent double clicks with a
> linkSubmit.
>
> With a regular submit, you can just disable the submit button after
> observing a FORM_PREPARE_FOR_SUBMIT_EVENT, but this doesn't seem to
> work for a linkSubmit element.
>
> Using T5.1.0.8-SNAPSHOT.
>
> Any ideas?  Have also tried stopping the event but that doesn't seem
> to do anything.
>
> -Dave
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>