Are you saying upon first submission you want the error returned indicating 
there is already an organization with the submitted coc_number and 
subdossier_number, but then you want to allow the user to re-submit the 
duplicate anyway and have it accepted upon re-submission (in other words, 
the initial error is really more of a warning that the user is free to 
ignore)?

Anthony

On Tuesday, October 9, 2012 12:44:54 PM UTC-4, Annet wrote:
>
> In a function I have the following code:
>
> 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)
>     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)
>
> The problem is that some organizations do have the same coc_number and 
> subdossier_number but differ in name and address, so after the warning 
> flash I'd like to be able to submit the form again and just call 
> processForm(form) so without checking whether the database contains the 
> organization or not.
>
> What is the best way to code this?
>
>
> Kind regards,
>
> Annet.
>
>

-- 



Reply via email to