You can try to set default before the creation of the form, something like:
db.booking.status.default="Booked" form = crud.create(db.booking) -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] On Fri, Apr 22, 2011 at 2:24 AM, Stifan Kristi <steve.van.chris...@gmail.com > wrote: > a, i c, thank you so much for your pointer anthony, is there any others way > to that without using update() or update_record()? > > thank you very much > > > On Fri, Apr 22, 2011 at 1:33 AM, Anthony <abasta...@gmail.com> wrote: > >> I think onaccept has to be a function. >> >> On Thursday, April 21, 2011 1:12:24 PM UTC-4, 黄祥 wrote: >> >>> hi, >>> >>> is it possible to create new record and update status simultaneously? >>> e.g. update() >>> def __add_2(): >>> form = crud.create(db.booking, next = URL(request.application, >>> request.controller, 'index'), onaccept = db.room(db.room.id == >>> request.vars.room_id).update(status = 'Booked')) >>> return dict(form = form) >>> >>> an error occured said: >>> AttributeError: 'NoneType' object has no attribute 'update' >>> >>> i've tried another (update_record): >>> def __add_2(): >>> form = crud.create(db.booking, next = URL(request.application, >>> request.controller, 'index'), onaccept = db.room(db.room.id == >>> request.vars.room_id).update_record(status = 'Booked')) >>> return dict(form = form) >>> >>> an error occured said: >>> AttributeError: 'NoneType' object has no attribute 'update_record' >>> >>> i know i was wrong, but i'm not understand where is my fault code, >>> could there anybody give me a pointer and shows me how to fix it? >>> >>> thank you so much before >> >> >