[html-formfu] Validate DBIx::Class unique constraints

Carl Franks fireartist at gmail.com
Fri Dec 3 11:35:20 GMT 2010


On 28 November 2010 17:17, Erez Schatz <moonbuzz at gmail.com> wrote:
> Hello,
>
> We've been using FormFu in a Catalyst-DBIx::Class project, and we've
> found that while FormFu has no problem updating the database, it ignores
> any unique key constraints (__PACKAGE__->add_unique_constraint([
> qw/field_name/ ]);), causing a DB exception to be thrown.
>
> I was attempting to circumvent this by creating a "Unique" class that
> would invalidate the form if a value exists in the DB. However, this
> doesn't work if the user enters his own information, and I've no way of
> getting the user's information from within a constrain_value sub.

Hi Erez,

There's also a HTML::FormFu::Constraint::DBIC::Unique included in the
HTML-FormFu-Model-DBIC distribution.
It may do what you want, but I've never used it myself.

I'm not sure what you mean by "this doesn't work if the user enters
his own information", can you give an example?

Cheers,
Carl



More information about the HTML-FormFu mailing list