On 04/06/07, Jason Kohles <[EMAIL PROTECTED]> 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
form.

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

Carl

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to