Skip to content

Commit

Permalink
gpasc-add-spinner-during-autosave: Added new snippet to show/hide a…
Browse files Browse the repository at this point in the history
… snipper during a GPASC auto save request.
  • Loading branch information
veryspry committed Jul 19, 2023
1 parent 13e0900 commit 27d6d0c
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Gravity Perks // Advanced Save and Continue // Add Spinner During Autosave
* https://gravitywiz.com/documentation/gravity-forms-advanced-save-continue/
*
* This snippet allows you to add a spinner during an auto save request and then remove it
* once the request is complete.
*
* Instructions:
* 1. Add snippet to form using https://gravitywiz.com/gravity-forms-custom-javascript/
* 2. Profit.
*/

gform.addAction( 'gpasc_auto_save_started', function( formId, gpasc ) {
var spinnerTarget = function() {
console.log( 'spinner target' );
return $( '.gform_save_link' );
}
gform.addFilter( 'gform_spinner_target_elem', spinnerTarget, 10, 'gpasc_spinner_target_elem' );
gformAddSpinner( formId );
gform.removeFilter( 'gform_spinner_target_elem', 10, 'gpasc_spinner_target_elem' );
} );

gform.addAction( 'gpasc_auto_save_finished', function( formId ) {
$( '#gform_ajax_spinner_' + formId ).remove();
} );

0 comments on commit 27d6d0c

Please sign in to comment.