Thanks,
I looked through my code and found several use of default, but for some
reason I used form.vars this time. Changing to default works perfect.
Kenneth
Hi Kenneth,
form.accepts will set the form.vars to the submitted values in the
request, overwriting anything you put there. I think you want to use
default:
db.t_status.f_status.default = statuses[0].id
form = SQLFORM(db.t_ticket)
...
On Jul 27, 10:38 am, Kenneth Lundström<[email protected]>
wrote:
I have this controller function (simplified to make it easier to read):
def testing():
statuses =
db(db.t_status.f_company==1).select(orderby=db.t_status.f_status)
form = SQLFORM(db.t_ticket)
form.vars.f_status = statuses[0].id
if form.accepts(request.vars, session):
response.flash = ('New ticket created')
return dict(form=form)
When the form is shown Status dropdown is selected with the first value
from db.t_status table.
When I fill out the form and submit it stores all values and a empty
form is shown. But the Status dropdown is not selected. If I reload the
page the value is shown in Status.
Any ideas whats wrong?
Kenneth