Validating 2 0 forms
Symfony ships with a Validator component that makes this task easy and transparent.This component is based on the JSR303 Bean Validation specification.
User studies from Christian Holst and Luke Wroblewski (separately) found that displaying an error when the user leaves a field, and keeping that error persistent until the issue is fixed, provided the best and fastest user experience.
Given a value, a constraint will tell you if that value adheres to the rules of the constraint.
The problem with that approach is that the resulting error would be associated with the entire form instead of being associated with the I have the same requirements with adding validation to fields depending on the value of other fields.
My Formatter looks like this: Still doesn't feel idiomatic enough for me...
It's been a long time I did this question, and since then, I've been working on my own validation framework for scala github.com/Nova Mage/SValidator.
While it might be tempting to simply do the bare minimum when it comes to wiring up forms, we really should give them a good amount of attention.