Description
This dynamic JavaScript filter hook is used to filter event arguments when a form is saved via AJAX in the form editor.
Usage
The filter which runs for all would be used like so:
gform.addFilter( 'gform_form_saving_filter_' + event_name , function( ...args, event, form ) {
//do something
}, 10, 2 );
Parameters
Events
- …args
One or more additional arguments passed for the current event. - event Javascript Object
The current event object. - form Javascript Object
The form currently being saved.
The following events can be used with this dynamic hook:
Event | …args | Description |
---|---|---|
save_began | Applies before the save process starts, but after the save button has been clicked or the save shortcut has been triggered. | |
save_aborted | Applies if the form failed validation after the save process has started. | |
save_in_progress | options | Applies just before the save request is sent, and after the form object has been validated. Once this action is fired the UI enters a loading state. |
save_request_failed | response | Applies if the request failed due to a network error. |
save_failed | responseData | Applies if saving the form failed. |
save_succeeded | response | Applies if saving the form was successful. |
save_completed | Applies once the save request is completed. This event is always triggered – even if the request failed. | |
script_before_reload | NewScriptElement scriptElementID currentScriptElement | Applies just before a script tag is being replaced. |
script_after_reload | NewScriptElement scriptElementID replacedScriptElement | Applies just after the script tag has been replaced. |
element_before_reload | newElement elementID currentElement | Applies just before an element is being replaced. |
element_after_reload | newElement elementID replacedElement | Applies after an element has been replaced. |
before_field_setting_added | newSettingElement | Applies just before a new field setting is added. |
after_field_setting_added | newSettingElement | Applies just after a new field setting has been added. |
before_field_setting_deleted | settingElement | Applies just before a field setting element is deleted. |
after_field_setting_deleted | settingElement | Applies just after a field setting element has been deleted. |
before_field_setting_update | currentSettingElement newSettingElement | Applies just before a setting element that has the data-js-reload attribute is replaced. |
after_field_setting_update | settingElement | Applies just after a setting element that has the data-js-reload attribute has been replaced. |
Note: Events related to scripts and elements require that the data-js-reload
attribute be present on those elements in the form editor. All elements (i.e. script tags, fields, and field settings) in the form editor that have the data-js-reload
attribute will be replaced after a successful save. By default, field settings don’t have the data-js-reload attribute, if you want your field setting to be always replaced with the new markup, you have to add the data-js-reload attribute to its markup.
Since
This action hook was added in Gravity Forms 2.6
Source Code
This action is located in FormSaverEventsManager.trigger() in /assets/js/src/admin/save-form/form-saver-events-manager.js