First, you don't want to do the check after calling form.process, because then the record will already have been inserted into the db before you do the check. Instead, maybe use an onvalidation function, and have the function fail validation the first time (and set the appropriate flash message) but pass validation the second time. To control whether validation fails or passes, you could set a session variable (e.g., session.allow_duplicate). If the form is submitted with a duplicate and there is no session.allow_duplicate, then set session.allow_duplicate=True and return the warning message. On the second submission, session.allow_duplicate will be True (at which point you should clear it or set it to False so it doesn't get re-used for subsequent submissions), and in that case you can let validation pass.
Anthony On Wednesday, October 10, 2012 11:29:23 AM UTC-4, Annet wrote: > > Hi Anthony, > > 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) > > > Yes, that's exactly what I want. Is that possible? > > > Kind regards, > > Annet > --