[html-formfu] Re: How to write yml to confirm whether a record is
jonas.alves at gmail.com
Mon Jun 4 15:40:08 GMT 2007
On 04/06/07, Carl Franks <fireartist at gmail.com> wrote:
> 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.
Can you please explain why is it useless? I'm using this approach in production
and I'm satisfied with it.
> 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)
It is something that i check a lot before a form submit so it's handy
to have it in a constraint for reusability.
More information about the HTML-FormFu