WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Contact Form 7] AJAX Not Working with WP2.8 (27 posts)

  1. digitz
    Member
    Posted 4 years ago #

    Just upgraded to WP2.8, AJAX is not working in CF7 and also, the terms acceptance checkbox which disables the submit button is not working either.

    Any help would be appreciated.

  2. war59312
    Member
    Posted 4 years ago #

    Indeed. :(

  3. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    Really? It's working on my site. I'm using WP 2.8 + CF7 1.10.0.1.

  4. jinkim
    Member
    Posted 4 years ago #

    I found a couple of bugs in wp-contact-form-7.php.

    1) in function wpcf7_plugin_url( $path = '' )

    global $wp_version;

    Needs to be added before the first if statement so that the variable is available within that function.

    2) in function wpcf7_enqueue_scripts()

    TRUE should be removed as a parameter passed to wp_enqueue_script as it's not a valid parameter.

  5. jinkim
    Member
    Posted 4 years ago #

    FYI, the whole point is that w/ those bugs the necessary JS files do not get included on the page via wp_head() in the templates.

  6. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    1) in function wpcf7_plugin_url( $path = '' )

    global $wp_version;

    Needs to be added before the first if statement so that the variable is available within that function.

    oops. I forgot the global declaration. Thanks jinkim.

    2) in function wpcf7_enqueue_scripts()

    TRUE should be removed as a parameter passed to wp_enqueue_script as it's not a valid parameter.

    The fifth parameter of wp_enqueue_script is supported from WP 2.8.

    http://core.trac.wordpress.org/browser/tags/2.8/wp-includes/functions.wp-scripts.php#L82

    When the value is set as true, the script will be included in the footer, instead of the header.

  7. digitz
    Member
    Posted 4 years ago #

    Takayuki,

    Would you please issue a patch for this problem?

  8. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    You can see the changed point here.

    http://plugins.trac.wordpress.org/changeset/125989/contact-form-7/trunk/wp-contact-form-7.php

    If you need the whole package, download from here.

    http://wordpress.org/extend/plugins/contact-form-7/download/

    ('Development Version' at the bottom)

  9. digitz
    Member
    Posted 4 years ago #

    Still, this fix didn't help with the AJAX issue.

    Submit button isn't disabled before confirming the "terms" checkbox, plus AJAX is not functioning, in other words, the whole page refreshes after the form is submitted.

  10. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    Maybe there are some JavaScript conflicts on your site. Can I see the site so I can point out the conflicts?

  11. digitz
    Member
    Posted 4 years ago #

    m u s a v i s . c o m

  12. digitz
    Member
    Posted 4 years ago #

    Takayuki, but it was working great on WP 2.7.1
    Upgrading to WP 2.8 messed things up.

  13. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    Oh, sorry! I forgot to mention this.

    Since WP2.8, the javascripts of Contact Form 7 are loaded in the footer of the pages, instead of header. So you need to call wp_footer() in the footer.php of your using template, like wp_header() in header.php.

    This article describes it in detail.

    Loading JavaScript In Footer In WordPress 2.8

  14. digitz
    Member
    Posted 4 years ago #

    I inserted the following code at the top of my footer.php:

    <?php wp_footer(); ?>

    But still no use.

  15. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    Okay, the javascripts came to be shown on the footer. Now another problem is conflict with other javascripts. By looking at the HTML source, jQuery.js is loaded twice (line #15 and #218), and FireBug shows error in the slider.js (#219). They are blocking the javascripts of Contact Form 7 from working.

  16. AprilX
    Member
    Posted 4 years ago #

    I'm having the same problem re: Ajax. The forms submit and I get the emails, but the "your form was sent, etc" notice isn't working; the form just refreshes.

    wp_footer(); is called in the footer. jQuery.js is called in the head and jQuery.form.js in the footer. I've tried removing them (first one, then the other), and it breaks the plugin, so I'm all out of ideas.

  17. AprilX
    Member
    Posted 4 years ago #

    Hmm. Strangely enough, the issue seems to have resolved itself in my case.

  18. digitz
    Member
    Posted 4 years ago #

    Downgrading to WP 2.7.1 has fixed the problem temporarily.
    Must be something in the WP 2.8 core that's causing all the mischief.
    Takayuki, any ideas?

  19. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    digitz, it is caused by javascript conflicts without a doubt. Try it on WP 2.8 with default theme and no other plugins. It should work.

  20. war59312
    Member
    Posted 4 years ago #

    Added the footer call and now working fine. :)

    Though, can you please add an option so that it can still be loaded in the header?

    Why? Well because I would like for it to work correctly with PHP Speedy again:

    http://aciddrop.com/2009/02/02/php-speedy-wp-052-bug-fix/

    Thanks!!

  21. digitz
    Member
    Posted 4 years ago #

    I'm currently working on a new theme for my website. I'll definitely try it out after I revamp my site.

    Thanks Takayuki

  22. shaarp
    Member
    Posted 4 years ago #

    Takayuki,
    I installed Contact Form 7 1.10 on WP 2.8 and also get the "turning arrows" ajax image when testing the form on Firefox 3.0.11. It also does the same thing on Google Chrome. When testing form on IE 8, it works fine and returns "Your message was sent successfully. Thanks.".

    After sifting through the WP forum and reading the many comments, I am stumped. Any outlook on addressing this?

  23. war59312
    Member
    Posted 4 years ago #

    Though, can you please add an option so that it can still be loaded in the header?

    Whoooo! Thanks!

  24. aredorange
    Member
    Posted 4 years ago #

    I am using WordPress 2.8.1 and Atahualpa 3.3.3 theme. I am using the plugin Contact 7 (version 1.10.1) form within the Text Widget (see http://www.lifem.org.uk). However, I have not received any email comment so far and did just a test email using one of my email accounts - got no email. So it seems something is not working... can you help please, as I am afraid many people will complain for not receiving any replies, when in fact I do not receive their emails...

  25. disllex
    Member
    Posted 4 years ago #

    I'm with the same problem, shaarp.

  26. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    @shaarp @disllex this FAQ topic might be helpful for you.

    My contact form behaves oddly on certain browsers.

  27. madhavaji
    Member
    Posted 3 years ago #

    Dang! I'm having the same problem.

    Disabled all plugins, returned to default theme, ensured wp_footer() in footer.php, checked for js conflicts - there are none ... no cigar.

    Downgraded to the previous version of Contact Form 7, success!

    So, the only difference between the working and non working contact form is the version of contact form 7.

    http://spankyvandykes.com

Topic Closed

This topic has been closed to new replies.

About this Topic