Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82284

Conditional Validation Server Side

$
0
0

Hi Allan,
I have a table in which I want to perform a conditional validation based on another field value in the same row. In this table are two fields users.student_number and users.role.

Field::inst('users.student_number')
    ->validator('Validate::unique')
    ->validator('Validate::notEmpty'),

This is the validation I want if users.role is student, but if users.role is teacher, etc., then I do not want to validate this field.
I have been attempting custom validators and the use of functions but I cannot seem to figure out how to use your built in validators at the same time. Is this possible?

Thanks for all of your help in the past,
Bo


Viewing all articles
Browse latest Browse all 82284

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>