Support » Plugin: Contact Form 7 » Latest version 5.4 breaking ajax form

  • Hello,

    Before the latest version 5.4 below code is working fine for ajax content with contact form shortcode but in the latest version, it throws error Uncaught TypeError: wpcf7.initForm is not a function

    
    $( 'div.wpcf7 > form' ).each( function() {
    	var $form = $( this );
    		wpcf7.initForm( $form );
    
    	if ( wpcf7.cached ) {
    		wpcf7.refill( $form );
    	}
    });
Viewing 4 replies - 1 through 4 (of 4 total)
  • I had problems too. Got an error with wpcf7 and multistep form together said that: wp-admin/admin-ajax.php?action=cf7mls_validation server 500. Debugged down to latest update and then made rollback to 5.3 and it worked again. Please fix 5.4, it’s frustrating when auto-updates are on and clients can’t contact.

    maushawk

    (@maushawk)

    Same issue here… Still happening 3 months later.

    Erik

    (@codekraft)

    hi @mukesh27 where you find that function? Is it wrong how can it work?
    use is wpcf7.init (wpcf7.initForm was outdated) if needed.

    $( 'div.wpcf7 > form' ).each( function(wpcf7) {
      var $form = $( this );
      $form.init( $form );
    
      if ( $form.cached ) {
        $form.refill( $form );
      }
    });

    But I want to advise that if the cache is active wpcf7 reloads itself automatically so do this is useless/wasting time

    For anyone else who comes here looking for a possible solution. I did some digging through the CF7 releases between 5.3 and 5.4.1. I have gotten my AJAX powered forms working again by changing the refill method to reset.

    - wpcf7.refill($form);
    + wpcf7.reset($form);
    

    Hopefully that helps someone out here too.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.