Hi,
I create form with ten fields when i checked one checkbox it validate all fields otherwise it not validate that all fields.
t has many ways to do that. Here I have mentioned the simplest way for it.
// Assign your checkbox value into $isChecked variable.
$isChecked = $this->request->date['your_check_box'];
// If checked
if($isChecked){
// then it will create new entity with validation
$data = $this->YOUR_MODEL_NAME->newEntity($this->request->date, ['validate' => true]);
}
else{
// otherwise it will create new entity without validation
$data = $this->YOUR_MODEL_NAME->newEntity($this->request->date, ['validate' => false]);
}
Conditional Validation in Cake is in the book: https://book.cakephp.org/3.0/en/core-libraries/validation.html#conditional-validation
Also my tutorial with an example of its use: http://www.naidim.org/cakephp-3-tutorial-21-conditional-validation