Need validators that aren't attached to a form field
|Reported by:||Simon Willison||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In implementing CSRF protection (#510) I needed to add a validator to the validation chain that wasn't tied to a specific field within the manipulator. This isn't currently possible. If implemented, it would also make validation rules that depend on more than one field a lot more elegant. In fact, it would let us ditch the requirement to pass all_data to validation functions.
I think Ian Bicking's FunFormKit takes this approach.
(Personally I'd like to replace Manipulators with a more general purpose idea of Validators - collections of validation rules. At the moment Manipulators are coupled to models, but there are situations where you would want to validate a form that doesn't directly relate to a model. Validation in Rails has exactly the same problem.)