PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Ajax error while setting post template

  1. Hello,
    I just purchased gravity forms this morning and got it installed w/o any problems. However, when I went in and created my first form, I tried to update the new form's name and description, then save the form. Nothing else has been done. When I click the "Save Form" blue button, the following pop-up error appears when using Chrome ver 3.0.195.33: "Ajax error while setting post template". If/when I click ok, nothing happens, except the form just continues like it is saving (the rotating gif keeps going), but nothing ever happens. In FF 3.5.5 I don't get an error, it just kinda gets stuck in the saving form loop with the gif image rotating and nothing ever happens.

    Your help on resolving this issue is greatly appreciated... especially considering it is the weekend now. :)

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  2. ... something else that I just noticed:

    I have a short php email script setup on my 404 error page so that I get notified by email everytime a user/bot encounters a missing or deleted page/file.

    I started getting the following error every time I navigate to the "Edit Form" section of gravity forms:
    On Sat Dec 12 2009 10:22:16 am CST, xx.xx.xxx.xxx tried to load :

    http://www.balancedlifeministry.org/wp-content/plugins/gravityforms/css/images/ui-bg_flat_75_ffffff_40x100.png

    User Agent = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.33 Safari/532.0

    When I look in the plugins folder on my server, the 'images' folder does not exist in '/wp-content/plugins/gravityforms/css'

    Just thought I would add this in to let you know about it. Its not that big of a deal to me, but I don't think that this error should happen each time I edit a form.

    Regards,
    Matt

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  3. Hey Matt, can you verify which version of jquery your site is using?

    The plugin needs jquery 1.3.2, can you verify that your admin is calling v1.3.2 and also double check to make sure that no other plugins are also including an older version of jquery on the page.

    Some plugins will add an older version of jQuery to the page, which causes a problem when multiple versions of jquery are present and Gravity Forms wants to use v1.3.2 functionality.

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  4. This could also be a plugin or them conflict. To determine this do the following:

    - Activate the default Kubrick theme
    - Test to see if Gravity Forms can save/edit a form

    If it can't then it is some sort of conflict with something your themes functions.php file is doing. If it doesn't work, then lets move on to determining if it is a plugin conflict.

    - Deativate ALL plugins
    - Activate Gravity Forms
    - Test to see if Gravity Forms can save/edit a form

    If it can, then it is a plugin conflict. You will now need to activate each plugin one by one, after you activate a plugin you will need to test Gravity Forms to see if you can save/edit a form. Once you find a plugin that causes Gravity Forms to no longer save when you activate it... that is the plugin causing some sort of conflict.

    Plugins can cause conflicts by doing things with javascript that they should not be doing, such as calling javascript on pages where it is not necessary... such as on the Gravity Forms admin pages... which can cause JS issues.

    Let me know what you determine, if you narrow it down to a specific plugin we can look into why that plugin is causing a conflict and see if we can fix it on our end. We can't guarantee we can fix all conflicts because we can't change the code of someone else's plugin.

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  5. ok...

    Deactivated ALL plugins and I went back to the default theme, all to no avail. I am still getting the same error.

    Also, when I view the source code of my wp admin area, I can't see that jQuery is being loaded anywhere! I am using WP 2.8.6

    Is there any chance that I have a bad copy of the download of gravity forms? Should I just delete the plugin and re-upload/activate?

    P.S. Thanks for the quick response. I had ticked the "Subscribe to this topic Via Email" but I never got any emails, so I thought that no one had replied yet. Anyway, thanks.

    Regards,
    Matt

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  6. I really do think that there is a problem with the version that I downloaded because of the missing images folder that I mentioned earlier.

    What do you think?

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  7. I think the missing image is probably just bug on our end, we made some changes in the 1.3 release and this could be related to that. We will look at it.

    As for the specific issue you are having, can you provide us with a WordPress login for this site so we can take a look? You can send it to us via the Contact Us form or email it to me directly at carl -at- rocketgenius.com and we can take a look at it and see whats going on.

    Posted 15 years ago on Saturday December 12, 2009 | Permalink
  8. I just sent you an email ...

    Posted 15 years ago on Sunday December 13, 2009 | Permalink
  9. Matt,
    The problem is that something on your system (hosting or WP install) is causing the AJAX request to be sent to the server with the "OPTIONS" method instead of "POST". This prevents the AJAX request from being processed correctly.

    I am not sure what exactly could do this, but I would start by setting up an out of the box WP install and see if the problem persists. If so, I would contact your hosting provider.

    Posted 15 years ago on Wednesday December 16, 2009 | Permalink
  10. Would it be possible for you to please post the part of your code that it is making AJAX request to the APache server?

    I am not trying to modify/steal anything... I would just like to be able to show this small portion of code to someone else so that I can prove that you guys are doing your part right.

    The people that I have talked to so far are thinking that it is the code that is written incorrectly, so until I can show them that it is right, I can not prove that it isn't the code causing the problem.

    Thanks for your help.

    Posted 15 years ago on Saturday December 19, 2009 | Permalink
  11. Matt,
    Following is the Javascript code that executes the AJAX. It uses the SACK library that comes with WordPress.

    <p>var mysack = new sack("<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
        mysack.execute = 1;
        mysack.method = 'POST';
        mysack.setVar( "action", "rg_save_form" );
        mysack.setVar( "rg_save_form", "<?php echo wp_create_nonce("rg_save_form") ?>" );
        mysack.setVar( "id", form.id );
        mysack.setVar( "form", jQuery.toJSON(form) );
        mysack.encVar( "cookie", document.cookie, false );
        mysack.onError = function() { alert('<?php _e("Ajax error while  saving your form", "gravityforms") ?>' )};
        mysack.runAJAX();
    Posted 15 years ago on Monday December 21, 2009 | Permalink
  12. Hey guys,
    I got someone on EE asking me how you determined that the AJAX request was being sent w/ 'OPTIONS' instead of 'POST'.

    Posted 15 years ago on Tuesday December 22, 2009 | Permalink
  13. For what it's worth, I'm a brand new customer and I am seeing the exact same problem with WPMU. Reverting to the Kubrick theme does not help.

    Any advice? Thanks.

    edit: I am running the admin with SSL. I noticed that the ajax code calls:

    var mysack = new sack("http://servername/test/wp-admin/admin-ajax.php" );

    My guess is that this needs to be SSL'd.

    In the gravity forms source, I see that this is called with a line like:

    var mysack = new sack("<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );

    Since bloginfo( 'wpurl' ); is the public (non-ssl'd) url, I am not sure how to fix this.

    Posted 14 years ago on Wednesday January 13, 2010 | Permalink
  14. Perhaps the SSL issue is a red herring. However, I am seeing another SSL issue with Gravity Forms. Specifically, on the Gravity Form admin pages, there are mixed-content warnings, indicating a mix of HTTP and HTTPS content on the same page.

    For example, these resources are called via an HTTP url, when really they should have an HTTPS url.

    <script type='text/javascript' src='http://servername/test/wp-content/plugins/gravityforms/js/jquery.qtip-1.0.0-rc2.min.js?ver=2.8.6'></script>
    <script type='text/javascript' src='http://servername/test/wp-content/plugins/gravityforms/js/qtip_init.js?ver=2.8.6'></script>

    and

    <img src="http://servername/test/wp-content/plugins/gravityforms/images/gravity-admin-icon.png" alt="" />

    It would be ideal if Gravity Forms sensed if SSL was active and did the right thing here.

    Thanks.
    -Bill

    Posted 14 years ago on Wednesday January 13, 2010 | Permalink
  15. FYI -- The problems I am seeing are definitely related to these settings in wp-config.php.

    define('FORCE_SSL_ADMIN', true);
    define('FORCE_SSL_LOGIN', true);

    If I comment out the first one, Gravity Forms seems to work "better", while maintaining the secure login.

    Posted 14 years ago on Wednesday January 13, 2010 | Permalink