[html-formfu] Automatic constraints from DBIC data types
Zbigniew Lukasiak
zzbbyy at gmail.com
Wed Oct 10 12:46:25 GMT 2007
Hi there,
I can start work on the DBIC constraints - but I am still hesitating
about the api. I've started with a subroutine that works similarly to
the other HTML::FormFu::DBIC subs:
constraints_from_dbic( $dbic, $form );
It would just scan all form fields and add the constraints from the
$dbic row. The problem I see is with configuration - since normal
constraints are added from the yaml config like:
elements:
- type: Text
name: foo
constraints:
- type: Length
min: 8
So this would be a bit different. We could also have something like:
elements:
- type: Text
name: foo
constraints:
- type: Length
min: 8
- type: From_DBIC
dbic_field: foofoo
But then when converting from a vanilla FormFu to FormFu::DBIC you
would have to edit the whole yaml config.
Hmm. Which one do you prefer? Any other api ideas?
Cheers,
Zbyszek
http://perlalchemy.blogspot.com/
More information about the HTML-FormFu
mailing list