Hi again, I try to use Form component but I can't. First case, when form is valid:
$form->getMessages()->appendMessage(new Message('general message')); //nothing
$form->get('email')->appendMessage(new Message('emai invalid 1')); //ok (add message to field property)
$form->getMessages(); //return empty object
Second case, form is invalid:
$form->isValid(['email' => 'invalid email']); //ensure is invalid
$form->getMessages()->appendMessage(new Message('general message')); //ok
$form->getMessages()->appendMessage(new Message('general message 2')); //ok
$form->get('email')->appendMessage(new Message('emai invalid 1')); //ok (add message to field property)
$form->get('email')->appendMessage(new Message('email invalid 2')); //ok as above
$form->getMessages(); //show messages, but not all (email messages are ignored)
To my thinking base problems are two:
- different behaviour when form is valid/invalid (or maybe messages are empty)
- isValid method, it seems to copy messages from fields to form messages property, but only first message (when I have more validators I'd like to show all messages) and overwrite messages list
So I want:
- to show messages from all validators
- to have possibility to add custom messages