{hero}

postSubmit

Since: Editor 1.0

Submit complete event (before the returned data is processed by Editor).
Please note - this property requires the Editor extension for DataTables.

The full Editor reference documentation is available to registered users of Editor - the information shown below is a summary only. If you already have an Editor license please , alternatively an Editor license can be purchased on this site, or sign up for the free trial.

Description

Post-submit event for the form, fired immediately after the data has been loaded by the Ajax call, allowing modification or any other interception of the data returned form the server. This event is called for both the success and error conditions - i.e. regardless of what the server returned, this event will be triggered. If you wish to manipulate the JSON that Editor will use as the data returned by the server, please modify the first argument (json) that is passed into the event handler, rather than trying to modify the responseJSON or responseText parameters of the XHR object, which Editor will abstract out the difference between. Important: If the server returns any data that is not valid JSON, Editor will fall into its error state and null will be passed in as the json parameter. If you want to manipulate this error response into a successful response, you need to use a custom complete function on the ajax object that will mutate the responseJSON/responseText (depending on your version of jQuery) parameters of the XHR object to contain valid JSON.

Event naming / backwards compatibility note

Prior to Editor 1.3, events were prefixed with the string on and this event was called onPostSubmit. That event name can still be used, and will function exactly the same way as the event documented here. The new name is used for simplicity and coherence with the event naming conventions in DataTables.