On Aug 4, 12:28 am, mattynoce <mattyn...@gmail.com> wrote:
> request.vars['hiddenfield'] = val
> immediately before the form.accepts part. i could confirm that it set
> properly and that request.vars found hiddenfield, but it still
> wouldn't update (even if i set db.table.hiddenfield.writable=True).
> something seems wrong there. is that by design? it was not a part of
> the sqlform but it becomes a part of request.vars immediately before
> the if form.accepts(request.vars, session), so i don't understand why
> it would be left behind.

Because it's not in 'form'
As Massimo says you can use:
form.vars[hiddenfield] = request.vars[hiddenfield]

> next i tried was your suggestion about processing the field manually
> in the "if form.accepts" part. the problem i'm finding is that
> form.accepts returns True or False rather than [id] or False. so i did
> this:
> a=form.accepts(request.vars,session)
> if a:
> ...
> but when i printed a, it printed not as 1 or 2 but as True. so it
> doesn't seem to be returning the identity that i would need in order
> to process an update. am i missing something there?

What I meant by 'processing' was the validation & DB insert, not using
form.accepts (that applies to 'form', this var wasn't in 'form').
Looking at this again, I guess that's hard for a create form...an
update form would be fine...

F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to