To validate forms, you define input filters on your model objects, like the following: https://github.com/akrabat/zf2-tutorial/blob/master/module/Album/src/Album/Model/Album.php#L38
But I see that input filters exist for form elements too, e.g.: https://github.com/zendframework/zf2/blob/master/library/Zend/Form/Element/Email.php#L126
Why are there input filters defined for both object models and form elements, which one is executed first? And if I have to customize the error messages for a specific field, do I have to do it on both places?
In most cases You should define input filters in Your model or even somewhere in your Form
classes. These input filters from form elements are default input filters for email so to facilitate you dont have to use input text field and define rules for filtering and validating these email, just use email element.
This is example what distinguishes simple text field from html5 email field. So email field is filtered by StringTrim
filter and then validated by regex. In comment you could see note about that validating regex is the same as browsers email input field validation.