Monday 7 February 2011

How to stop the user from clicking a page submit button more than once

The standard way to push the page data back to the APEX server is to use an HTML button. One issue with HTML buttons is that they can be clicked more than once, and under certain circumstances this can cause issues. To ensure that the button can only be pressed once you can do the following.

alter button settings so that inside the URL redirect section the URL target value is set to

javascript:this.disabled=true;doSubmit('SUBMIT')

Note that the value inside doSubmit('') is the same as the button name.

You can even go one step further and replace the text of the button to something relevant like "Submitting....". The following code does this

javascript:this.disabled=true;this.value='Submitting....';doSubmit('SUBMIT');

The button now looks like this when it has been clicked

Thats it, the button is now coded so that the user can only click it once to submit the page. Any further clicks are ignored.

0 comments:

Post a Comment

Apex Monkeys © 2008. Design by :Yanku Templates Sponsored by: Tutorial87 Commentcute Software blogs Computers Blogs