You have right! Instead of:
f1 = db.tab1.insert(field_gen='something') form = SQLFORM(db.tab1,record=db.tab1(f1),showid=False, \ fields=['field1','field_gen'], \ ) should be: if len(request.post_vars)==0: f1 = db.tab1.insert(field_gen='something') else: f1 = request.post_vars.id form = SQLFORM(db.tab1,record=db.tab1(f1),showid=False, \ fields=['field1','field_gen'], \ ) W dniu niedziela, 28 lipca 2013 16:39:40 UTC+2 użytkownik Alan Etkin napisał: > > I can't solve problem with SQLFORM update. I need to compute some field >> (`field_gen`), and be sure, that form filled by an user will be inserted in >> the same record. >> > > Can you show the actual controller (the action that processes the form)? > > Note that If you use a self submitted update form and also create a new > record for each action call (including form submission), then the form will > not be accepted since it is created each time (even if it has not errors). > If this is the case, I'd create the record in a separated action and > redirect to the form action adding /<table>/<id> to the request arguments. > Also you could store new record id in the session and check if it was > stored, so you can create the record only for the first action call. > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.