Validator configuration overridden with multiple validators of same type
Only one validator per type can be used in a form processor, since currently the form_processor_validation_factory
(\Civi\FormProcessor\Validation\Factory
) stores all validators keyed by name. This causes another instance of a validator type overwriting the configuration of the former instance and thus not validating correctly.
Validators should be stored per input instead.
Steps to reproduce:
- Add an input, add a validator with a specific value (e.g. min length) with a length value of 5
- Add another input, add a validator of the same type as for input 1 (min length) but with another length value (e.g. 10)
- Invoke the form processor, entering 6 characters in input 1
- Notice the input not validating, since it is now expecting a min length of 10, although this should only apply to input 2