You need to sign in to do that
Don't have an account?

Disable Submit Button to prevent Multiple form submission
Hi, and thank you for taking the time to look at my question.
I have a standard set of js functions that I use for form validation. One of the features I added was to disable the submit button before submitting the form to prevent a multiple submission. This is especially useful when submitting financial transactions, but in general it comes in handy.
HOWEVER when I try to implement this in my vf page, it makes the page reload, instead of redirecting to the correct page.
Does anyone have any idea why?
Here is a code snippet that I tried in my onSubmit function:
<!-- submit button
-->
<apex:commandButton id="submitArea" value="Sign Me Up!" action="{!save}"/>
<script type='text/javascript'>
document.getElementById('{!$Component.submitArea').disabled = true;
myApp = navigator.appVersion
if(myApp.indexOf('America Online Browser') == -1){
if(checkForm())
return true;
document.getElementById('!$Component.submitArea').disabled = false;
return false;
}
return true;
</script>
Can you please try this :
Thanks for taking the time to answer.
When I do that it prevents form submission, and DOES NOT disable the button! It does go to the onsubmit function, and then when it's finished it just stops.
Any ideas?
I had the same thing using chrome as the browser - disabling via onclick worked for firefox and IE.
I've ended up using something similar to the following:
It doesn't actually disable the button, but stops the user clicking on it.