Magento: Do some action after magento form validation
In Magento, we are having default validation function called VarienForm , if we pass our form id it will validate the input fields based on the class we specified into it. Ex. required-entry, validate-email . If we want to do some action before submitting form, follow below code to catch the success action. var dataForm = new VarienForm('reach-form-validate'); $('reach_us_submit').observe('click', function(){ if(dataForm.validator.validate()){ jQuery('#reach_us_submit').attr('disabled','disabled'); dataForm.form.submit(); } else { jQuery('#reach_us_submit').removeAttr('disabled'); } }.bind(dataForm));