Yeah, I fix it.  Just moved things around.  Thanks!
BR,
Jason

On 01/26/2011 11:00 PM, Niphlod wrote:
in other techical words, you can't know in advance what id will have
the "line" you are inserting to....you know that only after actually
inserting the row into the database

On 25 Gen, 15:48, DenesL<[email protected]>  wrote:
Hi Jason,

onvalidation runs before the record is inserted so form.vars.id does
not have a value yet.

You have to move the code from conference_form_details and place it
after the accepts.

Denes.

On Jan 25, 9:11 am, Jason Brower<[email protected]>  wrote:

I have this...
def create_event():
      '''
      INFO:This is the page that creates events.
      '''
      form = SQLFORM(db.conference)
      if form.accepts(request.vars, session, onvalidation =
conference_form_details):
          session.flash = "Great!  Your conference is created!"
      return dict(form = form)
def conference_form_details(form):
      form.vars.creator = auth.user.id
      role_id = 1 #The is the event administrator id'
      print form.vars
      db.user_role.insert(user_id = auth.user.id, role_id = 1,
conference_id = form.vars.id)
      db.commit()
in particular I thought that this:
form.vars.id
would give me the id that was to be used in this form, but I think I am
wrong as it returns None and printing form.vars shows key of 'id'
Any ideas how to get the id?
---
Best Regards,
Jason Brower


Reply via email to