Create validation after field validation
Hello everyone. I need to create some validation rules that should be applied after the validations that are in the fields and before saving. For example, the sum of X fields cannot exceed 100 and others. This applies to both Create and Update. In which method should I implement them? And if anyone has a simple example, I would appreciate it. Thanks.
5 Replies
I tried to use this but it didn't work. I think I did something wrong. I'll post the code I made and if possible correct me. Another thing is it possible to use this beforevalidate also in the Edit Page?
protected function afterValidate(): void
{
$this->addError('TRATO1', 'XXXXXXX');
}
I did it this way and it added the error to the bag correctly but did not stop the flow. I followed it and saved it normally.Solution
My hero.... thks...