Discussion:
Prevent Submit Button Clicked Twice/ Prevent Double Click
Federico Cattozzi
2009-04-15 16:32:56 UTC
Permalink
Hi,i'm italian developer and i'm new member of this mailing list.
I have a problem with WO: in a my application there is a booking wizard
composed by a sequence of components, from a component to the next i send
some data with a form with attribute "multipleSubmit = true;" (because the
are two WOSubmitButton, one to undo and one to continue), good, how can i
prevent a submit button to click twice?
Setting WOAllowsConcurrentRequestHandling=false property seems doesn't help
me.
Using Javascript like this onclick = "this.disabled=true; this.submit();" to
disable the button while the component is calculating, blocks the
submitting.

Please, help me.
Thank you.
--
Federico Cattozzi
Chuck Hill
2009-04-15 16:45:11 UTC
Permalink
Hi Federico,
Post by Federico Cattozzi
Hi,
i'm italian developer and i'm new member of this mailing list.
Welcome!
Post by Federico Cattozzi
I have a problem with WO: in a my application there is a booking
wizard composed by a sequence of components, from a component to the
next i send some data with a form with attribute "multipleSubmit =
true;" (because the are two WOSubmitButton, one to undo and one to
continue), good, how can i prevent a submit button to click twice?
Setting WOAllowsConcurrentRequestHandling=false property seems
doesn't help me.
No, that is for something different. You probably want that set to
true.
Post by Federico Cattozzi
Using Javascript like this onclick = "this.disabled=true;
this.submit();" to disable the button while the component is
calculating, blocks the submitting.
The best solution is probably to make your application able to handle
double clicking. One way to do this is to set a flag when the first
click is detected and then just return the next page (or the current
page) if a second click happens.

JavaScript like this might work:

onclick = "this.submit(); this.disabled=true;"


Chuck
Post by Federico Cattozzi
Please, help me.
Thank you.
--
Federico Cattozzi
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
Travis Britt
2009-04-15 16:50:19 UTC
Permalink
I like Chuck's suggestion of using a flag in your WOComponent code.
Probably the most iron-clad solution.

Another way to handle this is to use CSS/JS and create a busy div, a
div with content that indicates work is being done. Initially set its
display to none so it's not visible. When a button is clicked hide the
button(s) and show the busy div.

If you are using Ajax and Project Wonder AjaxBusyIndicator may be of
use to you.

tb
Post by Federico Cattozzi
Hi,
i'm italian developer and i'm new member of this mailing list.
I have a problem with WO: in a my application there is a booking
wizard composed by a sequence of components, from a component to the
next i send some data with a form with attribute "multipleSubmit =
true;" (because the are two WOSubmitButton, one to undo and one to
continue), good, how can i prevent a submit button to click twice?
Setting WOAllowsConcurrentRequestHandling=false property seems
doesn't help me.
Using Javascript like this onclick = "this.disabled=true;
this.submit();" to disable the button while the component is
calculating, blocks the submitting.
Loading...