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;
</script>