preSubmit
Pre-submit of data to server event (cancellable).
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 sign-in, alternatively an Editor license can be purchased on this site, or sign up for the free trial.
Description
Pre-submit event for the form, fired just before the data is submitted to the server. This event allows you to modify the data that will be submitted to the server. It is also cancellable by using return false;
in the event handler. This will stop the form from being submitted.
Note that this event runs after the formatData
callback function (3rd parameter) of the submit()
API method, if that function has been defined which submit()
is called. If you need to modify the data of the form using the API methods, please use the initSubmit
event.
If you are using Editor in local table editing mode (i.e. without the ajax
option), Editor will automatically assign a row id to newly created rows in the table based on the current timestamp. This event provides the option to customise the id set by simply assigning the value that you wish to the id property data source (idSrc
- typically this is DT_RowId
unless otherwise specified).
Event naming / backwards compatibility note
Prior to Editor 1.3, events were prefixed with the string on
and this event was called onPreSubmit
. 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.