Ajax override on datatable Editor and validation

Ajax override on datatable Editor and validation

mujahmujah Posts: 8Questions: 4Answers: 0
edited August 2016 in Free community support

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.

0.png 239.8K

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    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 :smile:.

    Allan

  • mujahmujah Posts: 8Questions: 4Answers: 0

    thank you Allan,
    I have updated my question, could you please try that, ?
    preSubmit seems only for form validation,
    many thanks for quick response.

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin
    Answer ✓

    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

This discussion has been closed.