Ajax override on datatable Editor and validation
Ajax override on datatable Editor and validation
mujah
Posts: 8Questions: 4Answers: 0
I am trying to add validation on datatable editor,
ajax: function (method, url, d, successCallback, errorCallback) {
var output = { data: [] };
if (d.action === 'create') {
}
else if (d.action === 'edit') {
}
else if (d.action === 'remove') {
}
successCallback(output);
}
});
using like this, but I want to use "errorCallback" and add validation here,
how can I use it to show as in attachment?
Update:
I am trying to use InlineEditing , and add validation there (offline) , I am using
https://editor.datatables.net/examples/advanced/localstorage.html (AJAX override).
case: add some validation, show error message when use try to edit/add data inline.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
For client-side validation you would probably be better off using the
preSubmit
event as shown here. Just remember to do it server-side as well .Allan
thank you Allan,
I have updated my question, could you please try that, ?
preSubmit seems only for form validation,
many thanks for quick response.
Error callback is used for if there is an error in the data processing. A validation error is not a data processing error - the request is successfully handled, its just that it contains invalid data. You still use the success callback for validation errors.
Allan