Chaining Validation

Chaining Validation

darrencassardarrencassar Posts: 1Questions: 1Answers: 0

Hi,

In https://datatables.net/forums/discussion/24472/chained-validation chained validation is said to be possible in v1.4 of datatables but I'm testing the viability of datatables.editor 1.5.6 and I'm still unable to chain validations. Can you please suggest how I can exclude any XSS as well as validate min and max or numeric or not empty etc.

cheers,
Darren

Answers

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    Hi Darren,

    You should indeed be able to chain validation - for example:

    Field::inst( 'age' )
      ->validator( 'Validate::notEmpty' )
      ->validator( 'Validate::maxNum', 150 )
      ->validator( 'Validate::minNum', 16 )
    

    (assuming you are using the PHP libraries? The same basic idea works with .NET as well)

    Allan

This discussion has been closed.