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 saving form

  1. Hi GF
    I have hit a problem when editing a rather large form. The form was created on my local machine and I exported the XML from there. The export file was then uploaded to the live site. When attempting to edit the form on the live site I get a JavaScript error:

    "Ajax error while saving form".

    I had a look on the forums and the only other post with a similar issue suggested increasing the PHP memory limit. I gave this a try but no luck.

    On further investigation I am seeing the following error in console:

    POST http://www.mysite.com/wp-admin/admin-ajax.php 406 (Not Acceptable)

    Any ideas on what could have caused this issue or how to fix it?

    Thanks

    Posted 12 years ago on Wednesday June 1, 2011 | Permalink
  2. Hi Toggle,

    My best guess is that your form meta may have been corrupted. Try the GF Meta Recovery Tool.

    Posted 12 years ago on Wednesday June 1, 2011 | Permalink
  3. Hi David
    Thanks for getting back. I gave that tool a try and ran it on of the forms. Unfortunately the situation has not changed much. The error message in console does vary occasionally now:

    "Failed to load resource: the server responded with a status of 406 (Not Acceptable) /wp-admin/wp-ajax.php"

    I am running the latest version of WordPress and the latest version of Gravity Forms. The form is a multi-part form with approx 55 inputs of varying types.

    Could this be a problem with the file wp-ajax.php? or the size of the form?

    Scott

    Posted 12 years ago on Wednesday June 1, 2011 | Permalink
  4. Does the form still work on the local machine?

    If you'd like to go ahead and send over your WP admin and FTP information I will take a look.

    Posted 12 years ago on Wednesday June 1, 2011 | Permalink
  5. Hi David
    Yup. The form still works well on my local machine.

    I decided to rebuild the form from scratch on the live server (rather than do the export -> import). It started off well but when I hit a certain field I was unable to save (same error as before). I thought it might be a size issue. Hitting a certain number of fields would cause the problem.

    So I started to remove fields and saving now causes the error every single time. I have tried to clean the meta and we are still seeing the problem. So once the error starts it seems to stay a persistent problem. Unfortunately due to the type of site this is I cannot provide you with logins and FTP access.

    If any ideas for testing spring to mind please let me know.

    Scott

    Posted 12 years ago on Friday June 3, 2011 | Permalink
  6. More progress. I continued to remove about 8 fields and once again the form started to save again. So I began adding them back and then once again hit a limit and had to start removing them again. This certainly appears to point at a size related problem. Memory? Issue with JS in the browser? - I will begin to investigate this.

    I can provide you with an export of the form if you need it (let me know where to send it).

    Many thanks

    Scott

    Posted 12 years ago on Friday June 3, 2011 | Permalink
  7. The bug can be re-created in all browsers. Interestingly Firebug reports:

    ... Firebug request size limit has been reached by Firebug. ...

    During the POST. So perhaps this is related too. Any way to disable the Ajax save of a form and POST it with a page refresh?

    Scott

    Posted 12 years ago on Friday June 3, 2011 | Permalink
  8. Hi Scott,

    Could you send us a WP admin login? We'd like to take a closer look at your setup. You can send it to david@rocketgenius.com. Please reference this post. :)

    Posted 12 years ago on Friday June 3, 2011 | Permalink
  9. I am having a similar problem, but "Ajax" isn't indicated in the error message. I already sent a contact email, as per error instruction but am afraid you will "ignore" it. Please let us know if this is a form size issue, and what can be done about that.

    And, please do take a look at my form to diagnose. All info is in the 'contact us' form.

    I just ran the meta recovery tool, and deleted each field i had entered since last successful save, and it will not save successfully again at that point.

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  10. This sounds like a PHP memory issue. If you run out of PHP memory you can't add additional fields to your form and AJAX will have problems executing. You need to increase your available PHP memory. Here is a tutorial that discusses how to do this:

    http://www.nerdgrind.com/increase-wordpress-and-php-memory-limit/

    I recommend configuring your site so that the PHP memory is set at a minimum of 64MB and preferably 128MB. The more plugins you run and the more complex those plugins are, as well as how complex your theme is, the more memory you are going to need.

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  11. I don't think its a memory issue since it worked fine 7 fields before, and now having deleted those 7 fields, it still won't save. There was a point where the whole form became not visible, I think I'd clicked ctrl C, and I had to refresh the page to get it back, all fields in tact. but would not save. so I suspect something happened and corrupted the db ?? With as huge a form as this is, to trouble shoot would be out of my range of knowledge without spending days. Any help for this?

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  12. What you describe still sounds like a memory issue. I would strongly suggest following the instructions in the tutorial and increasing your available PHP memory. When you begin to run out of available PHP memory, all sorts of strange issues and behavior will occur with the form builder.

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  13. I followed the memory limit instructions except that php.ini was not under etc, it was under public_html. I set the limit to 128M and this did not resolve the issue. How can I find whether the change took? And what would my next step be?

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  14. You may need to check with your web host, it varies fro host to host. You also need to make the change in your wp-config.php file which is mentioned in that tutorial. There are also plugins you can install int he WordPress.org repository that will tell you how much PHP memory you have available. Search for PHP Memory in the plugin repository and install/activate one of those plugins.

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  15. This could also be a mod_security firewall issue on your server. Here is how you can see if you have a mod_security firewall issue..

    - Create a new form
    - Add a Single Input field to the form
    - Save the form
    - It should save fine
    - Now edit this same form
    - Add a Checkbox field to your form
    - Save the form

    If you have a mod_security firewall settings issue, the form won't save after adding a checkbox, radio button or drop down field to your form. This is because your mod_security firewall settings on your web server are blocking the AJAX request and not saving the form. You'd have to discuss this with your web host if this is the case. It's usually a simple settings change on their end to resolve.

    Posted 12 years ago on Tuesday June 14, 2011 | Permalink
  16. We increased our memory and still can't edit the form. I created a smaller form which is saving and does include radios and checkboxes.

    Any ideas?

    Posted 12 years ago on Wednesday June 29, 2011 | Permalink
  17. Can you send me a WP admin login to alex@rocketgenius.com? I will be glad to take a closer look.

    Posted 12 years ago on Wednesday June 29, 2011 | Permalink
  18. Hi GF.

    I have also had problems saving my form (error message = "Ajax error while saving form") since I added many and more complex plugins on my WP-site.

    I followed the instruction above and increased my php-memory to 64 MB and it solved my problem and I am now able to save my forms again! If I run into the problem again I will most probably increase the memory to 128 MB.

    /Tobias from sweden

    Posted 12 years ago on Friday July 1, 2011 | Permalink
  19. LisaBell
    Member

    Hi, I have the same problem - Ajax error doesn't allow me to save or modify the form.
    I tried to follow the instruction to increase memory limit in wp-config.php. That file doesn't have a memory limit line, but I found another file that is called wp_settings.php and that file has a line:
    " // Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    wp_initial_constants( ); " Does it mean that I have to do something different to adjust the memory limit?

    Again, my issue is not being able to edit the file. I created it from scratch and it saved all the fields except some errors creeped in and when I try to correct them and save, I get the Adjax error.

    I look forward to your answer.

    Posted 12 years ago on Thursday July 7, 2011 | Permalink
  20. @LisaBell You shouldn't be making changes to wp_settings.php. Here is a tutorial on how to increase your PHP memory:

    http://www.nerdgrind.com/increase-wordpress-and-php-memory-limit/

    Posted 12 years ago on Thursday July 7, 2011 | Permalink
  21. LisaBell
    Member

    Carl, a combination of:

    - removing a few plugins
    - calling my hosting company and asking to increase php memory to 64 MB (the maximum they allow)
    - creating new entries instead of trying to edit the existing ones

    have done the trick. Thank you for your help. All set with that issue, at least for now.

    Thanks again.

    Posted 12 years ago on Friday July 8, 2011 | Permalink

This topic has been resolved and has been closed to new replies.