Hi Annet
Don't you have to put this kind of logic in a 'onvalidation' function?
I'm not sure this would work otherwise.
D
On Wednesday, October 10, 2012 7:35:00 AM UTC+1, Annet wrote:
>
> Massimo,
>
> Thanks for your reply. I tried:
>
> form=SQLFORM.factory(...)
> if form.process(keepvalues=True).accepted:
> organization=db((db.organization.cocNumber==form.vars.cocNumber)&\
>
> (db.organization.subdossierNumber==form.vars.subdossierNumber)).select(db.organization.ALL,cache=(cache.ram,3600))
> if organization:
> response.flash='The database already contains an organization with
> this coc_number and subdossier_number'
> else:
> processForm(form)
> elif form.errors:
> response.flash=responseFlash('formerror',session)
> elif not response.flash:
> response.flash=responseFlash('form',session)
> return dict(form=form)
>
> ... but that doesn't work, when I submit the form and the database already
> contains an organization with the same coc_number and subdossier_number,
> the flash 'The database already contains an organization with this
> coc_number and subdossier_number' displays and the form keeps its values,
> however, when I submit the form again, I get the same flash and the form
> isn't being processed.
>
>
> Kind regards,
>
> Annet.
>
--