hello one and all,
weird thing with updating an SQLFORM. i have a field definition:
Field('harry', length=10,
requires=IS_IN_SET(('DEFAULT','VALUE1','VALUE2')), default='DEFAULT'),
and here is the controller code:
def worksheet2b():
cidi = args_to_int(0)
sidi = args_to_int(1)
gidi = mcp.request_to_int(request.vars.pr)
prtype = "DEFAULT"
if (request.vars.pr == "a"):
prtype = "VALUE1"
elif (request.vars.pr == "b"):
prtype = "VALUE2"
if cidi and sidi:
tCase = db.cases
tSheet = db.case_worksheets
tGross = db.sheet_gross_adjustments
sCase = db(tCase.id==cidi).select().first()
sSheet = db(tSheet.id==sidi).select().first()
gform = SQLFORM(tGross, record=gidi)
gform.vars.case_id = sCase.id
gform.vars.case_worksheet_id = sSheet.id
gform.vars.party = prtype
if gform.process().accepted:
session.flash = "Gross Adjustments Updated"
redirect(URL(f="worksheet2a", args=[sCase.id,sSheet.id]))
elif gform.errors:
response.flash = "Gross Adjustment Errors"
return dict(prtype=prtype, sCase=sCase, sSheet=sSheet, gform=gform)
where you can see that i pass a vars.pr a value and the prtype variable is
updated with one of the two values which then sets it in gform.vars.party.
when i hit the submit button on the form, i get a gform error: "'party':
'value not allowed'". when i check the gform.vars.party value after the
submit, it is blank, but gform.vars.case_id
and gform.vars.case_worksheet_id are not blank and actually contain the
right values. so i don't get what is wrong here. it also does the same
thing if i pass pr as an args in the url.
i am using web2py 2.5.1 and postgresql 8.4.13 on a centos 6.3 machine.
thanx in advance. lucas
--
---
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.