Is it possible to change the behavior of the submit button on the contact form, so that it will only allow to click one time?

Now when you fill in the form and click multiple times on the submit button, it wil sent the contact form and email multiple times.

Is there a way to reduce this to only 1 time?

We are running Magento

  • Do you have a custom form or a custom theme?
    – Haim
    Nov 18, 2018 at 13:35
  • @Haim Yes it is a custom theme, but the contact form template is just the same as default.
    – JGeer
    Nov 18, 2018 at 16:36

1 Answer 1


Natively, in the Magento contact form, you can send only one form in the same time, if you are using a custom contact form or custom form you can just disable the double click on that button like the code bellow, if it's an AJAX form, you need to custom this code:


$(document).ready(function () {
     $("#buttonId").on('click', function() {  
           alert('Clicked'); // for test
           $(this).prop('disabled', true);
           $(this).css('cursor', 'not-allowed'); //additional


  • Thanks a lot! I tried that, it does disable the button, but it does not sent the form anymore. So it seems to break the form code.
    – JGeer
    Nov 18, 2018 at 16:37
  • Maybe you have some js error but this piece of code should not prevent the validation !
    – PЯINCƎ
    Nov 18, 2018 at 23:00
  • Thanks, well your code does work and block the button, but it does not validate anymore. So we can not sent the form and we do not have any JS errors.
    – JGeer
    Nov 19, 2018 at 7:32

Your Answer

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

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