I want to disable the submit button of the contact form onclick, so that the button can be only clicked once. The only problem with this, is that it does not validate the form anymore. It directly submit the form, reload the page and show a error when some field are not filled.

How can I change this, so that it will disable the button, than validate the form and when successful, it will submit the form?

Therefore I use the following code:

<button type="submit" onclick="this.disabled=true;this.form.submit();" title="<?php echo Mage::helper('contacts')->__('sent') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('sent') ?></span></span></button>

<script type="text/javascript">
    Validation.defaultOptions.immediate = true;

1 Answer 1


you can do by disabling after click once using jquery

 $(".class or #id").click(function () {
   $(".class or #id").attr("disabled", true);
   $('.class or #id').submit();

in the above way you need to change your button type submit to the only button and submit your form after disabling button in onclick

or try with the button to add onclick

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.