sorry if i misunderstand your question, this can be your help. http://web2py.com/book/default/chapter/07#SQLFORM-and-insert/update/delete says
SQLFORM creates a new db record when the form is accepted. Assuming 1. form=SQLFORM(db.test) , then the id of the last-created record will be accessible in myform.vars.id. On 3月27日, 午前8:46, Brian Will <brian.thomas.w...@gmail.com> wrote: > When using SQLFORM, I'd like to get the default/computed values of > fields not included in the form. Can I do this without making another > query? Can I get, say, the autogen'd id of the new record? For > example: > > form = SQLFORM(db.job_post, submit_button='Post Job', > formstyle='table2cols', > fields=['poster_name', 'poster_email', 'poster_phone', > 'zipcode', 'location_description', 'job_type', 'job_title', > 'job_description'], > _id='postjob' > ) > if form.accepts(request.vars, session): > # ... > > I want the 'id' and 'uuid' field values created when this form > accepts. To be honest, I'm not even sure how to do this with a query > except by matching on all provided fields (because none of the other > fields are unique), and that just feels ugly. > > Should I have to resort to a manual FORM in this instance? > > Thanks.