[html-formfu] Re: How to write yml to confirm whether a record is in db?

Carl Franks fireartist at gmail.com
Mon Jun 4 15:23:22 GMT 2007

On 04/06/07, Jason Kohles <email at jasonkohles.com> wrote:
> On Jun 2, 2007, at 7:45 AM, chylli wrote:
> > thanks for your reply. But  where can i find
> > HTML::FormFu::Constraint::DBIC::Unique ? seems it is not in
> > HTML::FormFu svn repository.
> >
> Hmm, that's interesting, I assumed it was in subversion, now I don't
> remember where I got it from.  Perhaps it was posted to the mailing
> list...
> Since Google can't seem to find it either, I'll attach a copy...

It was originally posted to the html-widget list by Jonas Alves.
I didn't add it to svn, but didn't get round to replying to explain
why - my bad!

Unless both the form processing and any subsequent use of the form
input, are wrapped within a DB transaction - then the uniqueness check
is rather useless.
And because the form processing is usually done by the catalyst
controller - before your code can access the form - transactions
aren't very practical.

I think the uniqueness check probably belongs in the user code - the
way I've done this in the past with html-widget was to add a blank
constraint that didn't really do anything, and then if my own code's
check failed, I would do $result->add_error() before redisplaying the

FormFu doesn't support add_error(), but you should be able to get the
same result with $constraint->force_errors(1)


More information about the HTML-FormFu mailing list