Support » Plugin: Gravity Forms Data Persistence Add-On Reloaded » Ajax saving not working

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author unclhos

    (@unclhos)

    Can you provide a link? There is only 2 possible reason I can think of at the moment. 1) You don’t have it selected to use AJAX saving (but I’m assuming you do). 2) you have something else loaded on your site with a javascript error that is stoping scripts from running.

    Thread Starter JayPatrol

    (@jaypatrol)

    Thanks for looking at this for me.

    I’ve double checked that the Ajax option is set:

    https://dl.dropboxusercontent.com/u/2022627/ajaxmeup.png

    This is a link to an example form:

    http://ecoaruk.staging.wpengine.com/eco-survey-non-saving-example/

    I’m not seeing any javascript errors in the console

    Plugin Author unclhos

    (@unclhos)

    I created a dummy account. Hope that is ok. http://ecoaruk.staging.wpengine.com/eco-survey-non-saving-example/ that link never showed me as logged in so the ajax script won’t be included. The other form here http://ecoaruk.staging.wpengine.com/eco-survey/ worked for me with ajax. I am using chrome. What browser are you using?

    Plugin Author unclhos

    (@unclhos)

    I just tested on Safari and Firefox too. Will need to find a computer to test IE.

    Thread Starter JayPatrol

    (@jaypatrol)

    Hi

    Thanks for much for your proactivity on this and, of course, I appreciate you creating an account to facilitate testing.

    I’m also a Mac user so Chrome/Safari/Firefox are the main browsers at my disposal and all giving the same results.

    It’s working for me on page 1 but not pages 2 through 5.

    Just to check we’re talking about the same process. I make a change to answer on, say page 2, navigate away, then come back either by browser navigation, pasting the URL, or clicking ‘Start a new survey’.

    It does work if I change survey page first (which is guess is the point at which the save is working) but not if I leave a page (other than page 1) and then come back to it.

    Hope this isn’t too unclear.

    Plugin Author unclhos

    (@unclhos)

    I never clicked “next” and all my answers are still there no matter how I get back to the page. The other person having an issue with AJAX is running this plugin. http://gravitywiz.com/documentation/gravity-forms-multi-page-form-navigation/ It looks like you are running something similar. On his site I found it is preventing my check for a change. The “fix” for this is to comment out two lines in the plugin until I can figure out what is wrong.
    This starts at line 113

    function gfdp_ajax($) {
    			//if (changed == true) {
    				var data = {
    					'action': 'gfdp_save',
    					'form': jQuery('form').serialize()
    				};
    
    				jQuery.ajax({
    					url: '<?php echo admin_url('admin-ajax.php'); ?>',
    					type: 'POST',
    					data: data,
    					success: function (response) {
    						changed = false;
    					}
    				})
    			//}
    		}
    		;

    The difference here is that it will submit every 10 secs no matter what, vs I had it submitting every 10 secs after a change. Just creates a lot more submissions to the server.

    Thread Starter JayPatrol

    (@jaypatrol)

    I think I must have read your plugin description as “Your user logs in to the site and starts filling up a 5-page form.” and thought – ahh – that’ s like ours – but I can see that 5-step is quite different.

    I’m seeing the code you’ve identified actually from line 87 (rather than 113) – version 3.2.3.

    I confess I was a bit unsure which lines to actually comment out and tried a couple of times but couldn’t get the anticipated result.

    I’m now thinking about the functionality when it does work as intended, though.
    I appreciate there’s a limit to what can be done with trying to deliver a bulletproof save option (ie. one that remembers what’s been done even if it was a millisecond before leaving the page) and I’m guessing you’ve set 10 seconds as a reasonable compromise between providing the functionality and not making unnecessary calls on the server.

    However the level of persistence we already get is very useful. It protects the user from losing whole pages worth of answers – and more if a user goes backwards and forwards.
    I’m not sure if the AJAX gives us much more benefit given that it relies on the user not to have made a change to the form up to 10 secs before they leave the page (as it stands wit the conflict with the multi-page plugin) or actually 10 secs without that conflict.

    …unless I’ve misunderstood – which I don’t rule out.

    Plugin Author unclhos

    (@unclhos)

    Yeah that wasn’t the issue anyways :'( It was allowing the ajax to go through but the saving still was not happening. Sorry about the line number, I have new changes about to be rolled out ( as soon as I can get this figured out ).

    Plugin Author unclhos

    (@unclhos)

    Ok I have narrowed down the problem. You and the other guy have same type of issue. Basically it boils down to there are multiple forms on the page and data from the wrong form is being sent to the server. I will work on a fix.

    Plugin Author unclhos

    (@unclhos)

    Oh and let me specify, that YOU don’t have 2 forms on the same page, but the plugin you are using for the navigation creates a hidden form that it uses to move around.

    Plugin Author unclhos

    (@unclhos)

    It’s not the navigation creating the extra form, it’s Gravity Forms AJAX. Try disabling that in your short code to see if it continues to work past the first page.

    Thread Starter JayPatrol

    (@jaypatrol)

    That has worked! Thanks very much for getting to the bottom of that. I really appreciate it.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Ajax saving not working’ is closed to new replies.