WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms Data Persistence Add-On
Plugin Not Working With Chrome Browser (5 posts)

  1. RGManager
    Member
    Posted 1 year ago #

    I'm having problems getting this plugin to work with Chrome. What is happening is after populating information and then either clicking the next button on mutlipage forms if there is any information missing that was required it will reload the page and show the areas that were missing, however on reload all the other data is deleted which requires the user to re-enter.... Does anyone have a solution for this?

    Thanks for your assistance.

    http://wordpress.org/extend/plugins/gravity-forms-data-persistence-add-on/

  2. Amity
    Member
    Posted 1 year ago #

    This is happening because the form data is only saved to the database when the page changes, which is prevented by the validation errors. When the page is redrawn and pre-populated with the data from the database after a validation error, it doesn't get any of the new entries on the page.

    I think you can fix this by adding a hook on the "gform_validation" action to save the form data to the database. I think WP's update_option() function handles cleaning up the data before it is added to the database, but you'll want to check that out yourself - especially where the validation has failed.

    Would be best to wait for the original author to update the plugin for this instance, but you can try this out by adding the following code to persistent_multipage_forms.php in the plugin directory (will be overwritten with any plugin updates!):

    add_action("gform_validation", "validate_and_save_gf_data");
    
    function validate_and_save_gf_data($validation_result) {
    	if ($validation_result['isValid'])
    		return $validation_result;
    
    	$form = $validation_result["form"];
    	if ($form['isPersistent']) {
    		if (is_user_logged_in()) {
    			$option_key = getFormOptionKeyForGF($form);
    			update_option($option_key, json_encode($_POST));
    		}
    	}
    	return $validation_result;
    }
  3. samb_nz
    Member
    Posted 1 year ago #

    @Amity , thanks for you post, super helpful !!

    Will suggest to plugin authors to add.

  4. jkirker
    Member
    Posted 1 year ago #

    Still not working in Chrome for me. ;(

  5. justradar
    Member
    Posted 1 year ago #

    Amity are you available for hire for a similar problem? please contact me

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic