I found myself having issue related to this... If I do this
db.table.field.default = Something And my field is readable and writable=False (because I don't want the user to see this field), I will not get the field "field" in form.vars, so I should do : form = SQLFORM(db.table) form.vars.field = Something Right? Richard On Tue, Feb 11, 2014 at 9:26 AM, Richard Vézina <[email protected] > wrote: > So, maybe I was completly wrong sorry... Though, I remember having issue > when passing vars throught the URL when they share the same name as a form > field... About request.get_vars ans post_vars, maybe it the solution, > though if I remember they were both sharing the same value... I should > package a little app that reproduce the problem... > > Anyway sorry for the noise. > > Richard > > > On Mon, Feb 10, 2014 at 1:45 PM, Anthony <[email protected]> wrote: > >> I'm not sure exactly what you're talking about, but specifically in this >> case, there should be no difference between setting the field default >> before form creation vs. setting form.vars after form creation (this is >> unrelated to whether there is a possibility of overwriting something in the >> session or whether a query string variable might conflict with a POST >> variable). >> >> Note, to distinguish between form variables submitted via a post and >> query string variables of the same name, use request.get_vars and >> request.post_vars. >> >> Anthony >> >> >> On Monday, February 10, 2014 12:50:24 PM UTC-5, Richard wrote: >> >>> I didn't mean users... I mean 2 differents person that use the same >>> session would lead to only one person order... I am not 100% sure, but I >>> had issue in the pass passing value to form.vars like this the controller >>> not taking value inputed in the form... That occure with request.vars.VAR, >>> if you pass a var like this throught the URL and VAR is included into form >>> input as input name, user input never taked into account and get overrided >>> by the request.vars.VAR... >>> >>> You can just test it. Maybe in your case since you pass the value before >>> the form get render it doesn't make issue, but I found .default = ... >>> cleaner. >>> >>> Richard >>> >>> >>> On Sun, Feb 9, 2014 at 9:02 PM, Anthony <[email protected]> wrote: >>> >>>> Massimo code should have been : >>>>> >>>>> db.reservations.PersonName.default = session.PersonName >>>>> >>>>> And you must use it, because the way you made it works will prevent >>>>> your user to change their name, let say for instance that 2 differents >>>>> persons order with the same form, the second person (if it has input his >>>>> name) will be override by the content of session.PersonName, that still >>>>> content the name of the person one since you pass it to >>>>> form.vars.PersonName directly... >>>>> >>>> >>>> Both methods (i.e., setting the field default value before creating the >>>> form, or setting the form.vars value after creating the form) should work >>>> the same. Two different people using the form won't affect each other >>>> because the each user has their own session. >>>> >>>> Anthony >>>> >>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> 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. >>>> >>> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> 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. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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.

