[html-formfu] Automatic constraints from DBIC data types
Mario Minati
mario.minati at googlemail.com
Thu Oct 11 19:12:03 GMT 2007
On Wednesday 10 October 2007 13:46:25 Zbigniew Lukasiak wrote:
> 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?
I'd rather prefer the first one as it's more intuitive.
Maybe we can add the attribute 'dbic_field' to Element so we can handle this
case, too.
Greets,
Mario
More information about the HTML-FormFu
mailing list