All,
I have a weird issue going on, although I'm obviously a newbie.
This is my code (I have added some debugging stuff):
def viewdata():
msg2 = ""
result2 = ""
result=db1(db1.data.id == request.vars.id).select().first()
msg = str(result.Status)
form = SQLFORM.factory(
Field("Status", requires=IS_IN_SET(status_options), default
= result.Status),
submit_button="Update")
if form.process().accepted:
if not result.Status == form.vars.Status:
result.update_record(Status=form.vars.Status)
msg2 = str(result.Status)
result2=db1(db1.data.id == request.vars.id).select().first()
return dict(msg=msg,msg2=msg2,result=result,form=form,result2=result2)
I load my page for the first time and this is the content:
*msg *: New
*msg2 *:
*result *:
Status :
New
delete_record :
<gluon.dal.RecordDeleter object at 0xa85f1ec>
id :
1L
update_record :
<gluon.dal.RecordUpdater object at 0xa85f1cc>
*result2 *:
Then I change status to "Open" and click update, however, the form
refreshes and it still says "New"... msg seems to be stuck to "New"?:
*msg *:
New
*msg2 *:
Open
*result *:
Status :
Open
delete_record :
<gluon.dal.RecordDeleter object at 0xb4e810c>
id :
1L
update_record :
<gluon.dal.RecordUpdater object at 0xb4e80ec>
*result2 *:
Status :
Open
delete_record :
<gluon.dal.RecordDeleter object at 0xb4e8f6c>
id :
1L
update_record :
<gluon.dal.RecordUpdater object at 0xb4e8f2c>
Then if I set it back to "Open" and click update again, it refreshes
correctly and the form says "Open".
It always takes two actions before the form is updated, however the entries
in the database are correct.
I'm probably missing something crucial here... Thanks in advance!
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.