initSubmit not firing for Editor
initSubmit not firing for Editor
I have several Editors in my app and each does client-side validation of the user-entered values.
The validation is done in "initSubmit" event handlers. They are simple validations such as enforcing that a value had been entered.
The validation was working fine and suddenly stopped working. I am confident that I had not changed the event handler (checked the history in git).
I added some debugging code and it seems that the initSubmit event is not firing at all.
But I did just purchase an Editor license ( I had been using the trial). I downloaded it and am now using v1.8.0. I am using DataTables v 1.10.15
I did not download any other components, just dataTables.editor.js and dataTables.editor.min.js The other components I am using were just downloaded within the last few weeks.
Could this be an issue? Did something change in the latest Editor?
Answers
x
My apologies, initSubmit does seem to be firing. But still, no error is raised. Below is a code sample. I even tried 'if (1 == 1) ...' to be sure the error would be raised.
eqpEditor.on("initSubmit", function (e, data, action) {
var eqpType = this.field('type_of_equipment');
});
I removed all code from the on("initSubmit") leaving just one line - "return false;".
Still it submitted data I had entered and ignored the return false.
Solved: I created two event handlers for every Editor - a preSumbit to validate the user input and an initSubmit perform any calculations or data updates.