Hi Anthony, Thanks for your reply, problem solved.
I have been struggling with an other problem for days, and I have no idea why the function doesn't do what I expect it do do. I have a database containing nodes being organizations and people. These organizations and people can register for plan 1, 2, 3 or 4. When they register for plan 2 or 4, I have to enter a node being a hub before registering them as users. This is the function: def register(): # get the registration form row=db(db.register.id==request.args(0)).select(db.register.ALL).first() # see whether an organization or persons wants to register if row.cocNumber and row.subdossierNumber: .... id=organization.nodeID elif row.lastName and row.birthday: ... id=person.nodeID # the database doesn't contain the organization or person else: session.flash='' redirect(URL('register')) # the organization or person wants to register for a hub if row.hub: if id: ownerID=id hub=db(db.hub.name==row.hub).select(db.hub.ALL).first() if hub: session.flash='The database already contains a hub named ' + str(row.hub) redirect(URL('register')) else: id=db.node.insert() db.hub.insert(nodeID=id,ownerID=ownerID,name=row.hub,label='Onbekend') ... form=SQLFORM.factory(db.auth_user,ignore_rw=True,separator='') # here I prepopulate the form based on row.field if form.process(keepvalues=False).accepted: ... elif form.errors: response.flash=response_flash('formerror',session) elif not response.flash: response.flash='...' return dict(form=form) This form is being processed correctly when an organization or person registers, however, when an organization or person registers for a hub, these lines are executed first: else: id=db.node.insert() db.hub.insert(nodeID=id,ownerID=ownerID,name=row.hub,label='Onbekend') then the form displays containing the correct value for nodeID (the id returned by the insert), but when I submit the form instead of making all the database inserts (as when an organization or person registers) the flash is being set to: 'The database already contains a hub named ' + str(row.hub) an no records are inserted. I don't see what's wrong with my logic, I hope you do, the issue is keeping me awake at night :-( Best regards, Annet --