organization=db((db.organization.cocNumber==form.vars.cocNumber)&\
(db.organization.subdossierNumber==form.vars.subdossierNumber)).select()
should be'
organization=db((db.organization.cocNumber==form.vars.cocNumber)&\
(db.organization.subdossierNumber==form.vars.subdossierNumber)).select().first()
On Friday, 7 September 2012 07:07:04 UTC-5, Annet wrote:
>
> I have a function with an SQLFORM.factory() form, after submission I check
> whether the database already contains an organization with the CoC number
> in the form, when it does I set a response.flash telling the user the
> database already contains that organization. Some organizations have
> branches with the same CoC number but different names and addresses, I
> would like the user to be able to enter these branches as well. I thought
> maybe adding a check box to the form which the user can check if he wants
> the form to be processed anyway would be the way to go. This is the form:
>
> form=SQLFORM.factory(db.node,db.organization,db.address)
> if form.process(keepvalues=True).accepted:
> organization=db((db.organization.cocNumber==form.vars.cocNumber)&\
>
> (db.organization.subdossierNumber==form.vars.subdossierNumber)).select()
> if organization:
> response.flash=form.vars.name + ' is ab branch of' +
> organization.name + ': '
> else:
> processForm(subclass,form)
> ....
> elif form.errors:
> response.flash=responseFlash('formerror')
> elif not response.flash:
> response.flash=responseFlash('form')
> return dict(form=form)
>
> Any ideas?
>
>
> Kind regards,
>
> Annet
>
--