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

Carl Franks fireartist at gmail.com
Mon Jun 4 16:00:30 GMT 2007

On 04/06/07, Jonas Alves <jonas.alves at gmail.com> wrote:
> On 04/06/07, Carl Franks <fireartist at gmail.com> wrote:
> >
> > 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.
> Hi Carl,
> Can you please explain why is it useless? I'm using this approach in production
> and I'm satisfied with it.

Ok, 'useless' was a rather emotive word, but I would say it's not a
good way to do it.

The word 'transaction' should have been enough of a clue as to what's
wrong with it.

If your database of choice doesn't support transactions, then you'll
need to use a unique index on the appropriate column, and just check
for errors when you attempt the insert.

> It is something that i check a lot before a form submit so it's handy
> to have it in a constraint for reusability.

I agree it's handy, but in this case that's conflicting with "working
Your choice ;)


More information about the HTML-FormFu mailing list