I understand the example at http://book.cakephp.org/complete/1143/Data-Validation#Adding-your-own-Validation-Methods-1181 on how to add my own validation methods, but maybe I'm missing something.
I only want to validate that Field_B is 'numeric' (a core validation) if Field_A (a select/option) is equal to a certain value.
It seems that I'm supposed to add a custom validation, and then I check the values of other fields with $this->data
, but how do I call on a built-in validation from within a custom validation function? Or am I doing it wrong?
Validation::numeric($this->data['field'])
Validation class (validation.php) is located in cake/cake/libs
and you can see the available methods by inspecting the file (they're the same as the ones you pass to the validation array).
Validation methods return true if validation passes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With