rpamaral rpamaral - 1 year ago 256
jQuery Question

How to add additional settings on error in Contact form 7?

I already know the function 'on_sent_ok' to add jQuery actions when the form is submitted with success.
However I want to display a modal window alerting the user when there are submitting erros. There's some function like the one above, but to be called on errors?

Answer Source

In version 3.3 new jQuery custom event triggers were introduced:

New: Introduce 5 new jQuery custom event triggers (invalid.wpcf7, spam.wpcf7, mailsent.wpcf7, mailfailed.wpcf7, submit.wpcf7).

See: http://contactform7.com/2012/09/24/contact-form-7-33/#more-2598

You can use invalid.wpcf7 like the example below:

  // Launch your modal window here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download