DomingoSL
DomingoSL

Reputation: 15504

Check for form errors on View

Is there a convenient way to check if there are any errors on a form on the view without having to modify the controller or looping across all the elements of my form.

I can do something like:

isset($this->formElementErrors($registrationForm->get('firstName')))

This is not quite elegant and again, i will need to call that for every element on my form. So is there any way to know if there is any error on the form compilation?

Upvotes: 0

Views: 39

Answers (1)

Exlord
Exlord

Reputation: 5391

$form->getMessages() or $form->getInputFilter()->getMessages()

Upvotes: 1

Related Questions