Hi, I've written a controller to add a record using sqlform, and I want to prepopulate several of the fields. I've had some success using form.var.field = x, but I haven't been able to prepopulate the one field that uses a dropdown list.
In the controller I listed below, I have success on the 'description' field, but not the 'cpaid' field. Any suggestions? Model: db.define_table('cpa', Field('cpa','string'), ... db.define_table('task', Field('cpaid'), Field('cpaord'), Field('cpa','string'), Field('description','string'), ... db.task.cpaid.requires = IS_IN_DB(db,'cpa.id','cpa.cpa') Controller. def insert_task_cpa(): form = SQLFORM(db.task) form.vars.description = 'Test Description' form.vars.cpaid = IS_IN_DB(db,db.cpa.id, '6') if form.accepts(request.vars,session): response.flash='Task added' redirect(URL('task_list_bycpa', args=cpa_id)) return dict(form=form)