Prevent the validator() method of a field from trggering

Prevent the validator() method of a field from trggering

scherbaumscherbaum Posts: 6Questions: 3Answers: 0

Hello,

I'm using bubble edit on a table, with all editable fields having validator() methods on the server side. The problem is, that when I try to edit one field, the validator method of another field (unchanged field) is triggering, which will result in an error message. Is there any way to disable validating unchanged fields?
I tried using the submit option as shown next with no luck.

$('#all_apps').on( 'click', 'tbody td.editable', function (e) {
        editor.bubble( this, {
            submit: 'changed'
        } );
    } );

Thanks!

This question has an accepted answers - jump to answer

Answers

  • scherbaumscherbaum Posts: 6Questions: 3Answers: 0

    I think I found the solution here:
    https://datatables.net/forums/discussion/39158/edit-and-validate-question

    So basically my validator method is a custom method, which means it will run regardless of whether the field was changed or not.

  • allanallan Posts: 56,849Questions: 1Answers: 9,035 Site admin
    Answer ✓

    Yes, regardless of whether the field is submitted or not, the validator will run. This is the server-side imposing its will on the client-side ;).

    What you can do, and what we do in our own validators though, is allow it to not be set. If so, then just allow it threw.

    Allan

  • scherbaumscherbaum Posts: 6Questions: 3Answers: 0

    Great, thanks!

Sign In or Register to comment.