• Contact Form 7 v 2.4.3
    Currently, Contact Form 7 clears the form values after submission. However, it clears these values before performing the on_sent_ok action, which I would like to use to perform an AJAX POST to a different form/file/whatever.

    Just wanted to share the fix — patch follows.

    Index: scripts.js
    ===================================================================
    --- scripts.js	(revision 36238)
    +++ scripts.js	(revision 36239)
    @@ -42,11 +42,14 @@
     						ro.addClass('wpcf7-spam-blocked');
    
     					if (1 == data.mailSent) {
    -						$(data.into).find('form').resetForm().clearForm();
     						ro.addClass('wpcf7-mail-sent-ok');
    
     						if (data.onSentOk)
     							$.each(data.onSentOk, function(i, n) { eval(n) });
    +
    +						//moving after onsent to preserve form values
    +						$(data.into).find('form').resetForm().clearForm();
    +
     					} else {
     						ro.addClass('wpcf7-mail-sent-ng');
     					}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Allow AJAX after Submit’ is closed to new replies.