I've succeeded in using a custom SQLFORM to restrict how many fields of a 
table the user has to fill out, but now I am trying to set a hidden field 
value (status) and struggling.

I tried in the model to use:
    form = SQLFORM(db.games)
    form.vars.status = 'active'

but the field never gets written to the db, I believe because it is not one 
of the fields declared in html (below).

I then tried through the html as 
{{form.vars.status = 'active'}}
but while it was in the Accepted form.vars, it doesn't show up in 
request.vars and again, doesn't get written.

So, okay, let's place it in the html as 
{{request.vars.status = 'active'}}
And now it gets into request.vars, but again is not written to the db.
 
I think I've sunk over my head on this one, and advice correcting my 
approach above would be greatly appreciated.
Or was this a bad path to start down and I should just use a separate 
operation to write this field to the table after the record is created?
Thanks,
Dave

html if it helps:
{{=form.custom.begin}}
{{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}
{{=form.custom.widget.tm_home}}
{{request.vars.status = "active"}}   <---  tried variations of this line & 
without it
{{=form.custom.submit}}
{{=form.custom.end}}

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to