Ouch. SilverStripe’s validators system turns out to be in need of a heavy rewrite – I hope that I won’t upset anyone by wiping out most of the RequiredFields code ;-)
Since we still need the “required field” functionality, I have to code some field-specific constraints first, so that we’re able to pass “required” as an argument to the FormField constructor (in a similiar way that Django does it).
The second step is making RequiredFields just another validator (enabled by default, but nowhere near its current state). I already have migrated some code from RequiredFields.php to its Validator.php parent and home to make the data validation experience much better for the developers. But before doing so – it’s time to write some Unit Tests.
There’s nothing better than heaps of asserts making sure that you don’t break anything while refactoring the code.