Skip Menu |

This queue is for tickets about the HTML-FormFu CPAN distribution.

Report information
The Basics
Id: 62963
Status: rejected
Priority: 0/
Queue: HTML-FormFu

People
Owner: Nobody in particular
Requestors: GUSTRA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08002
Fixed in: (no value)



Subject: Feature request: add high level validators
I have recently began using FormFu and I have notice that much validation is still done in the controller code, which could be part of FormFu framework instead. I would like to have validators on form level instead of on value level. Then it would be possible to standardize certain types of validations, eg that start- and end dates are in order, or either-of values are correct. Perhaps it could be implemented as Validators not connected to any value, which takes the form as input? Then there is no need to add a new name space.
The benefit of using Validators as they currently are, is that it's very easy to attach the error message to a field. Your suggestion would require some major changes. At the moment, a form is valid if no fields have errors, so there is no concept of any other type of error. It's also currently valid to call $form->validator() - it just adds the validator to all fields on the form. So we would need a new namespace and method-name. I think it's unlikely that current Validators can't handle what you're trying to do. If you write a custom Validator which overwrites the process() method, it receives ($self, $params) arguments, where $params are all field's submitted values.