validator on a second field

validator on a second field

whitbaconwhitbacon Posts: 40Questions: 2Answers: 0
edited May 2013 in Editor
Field::inst( 'casetype' )->validator( 'Validate::required' ),
Field::inst( 'factsnum' )->validator( function($val, $data, $opts) {

if ('casetype' == 'this' && strlen($val) < 3) {
return "Value must is required!";


}
return true;

} ),

How do I enter the input field of another value. In this case casetype!

In plain english if casetype is this the length of the string must be greater than 3.

Replies

  • allanallan Posts: 61,715Questions: 1Answers: 10,108 Site admin
    edited May 2013
    Use `$data['casetype']` . `$data` is the source data for the whole row.

    Allan
  • whitbaconwhitbacon Posts: 40Questions: 2Answers: 0
    Thank yo worked like a champ!
This discussion has been closed.