Setting up required fields that can be empty with Zend\InputFilter
When you create an input filter entry that has the required element set to true, then by default, the field is set up so that it must have a value in it. If you want the field to be required, but also an empty value is okay, then add the allow_empty element to your definition:
'name' => 'notes',
'required' => true,
'allow_empty' => true,
In this definition, we have a ‘notes’ element that must exist, but can be an empty string.
That’s all there is to it.