Yes! Thanks
I just can't keep the same name for the passed default variable value except if I wrote more code once form accepted or onaccept and the perefered way of managing this issue is by using a different name then the field name to share the default value between my to function. Richard On Thu, Mar 7, 2013 at 11:23 AM, Niphlod <[email protected]> wrote: > you have request.get_vars and request.post_vars to "obey" the method used. > request.vars holds both of them: is it clearer ? > > > On Thursday, March 7, 2013 5:08:37 PM UTC+1, Richard wrote: > >> Ok, miss the last line... "Generally speaking changing the GET var name >> is the "recommended" way." >> >> request.get_vars.fk_id doesn't work. >> >> Thanks >> >> Richard >> >> >> On Thu, Mar 7, 2013 at 11:05 AM, Richard Vézina <[email protected]>wrote: >> >>> So, if I do understand well I should do : >>> >>> db.table.fk_id.default=**request.get_vars.fk_id >>> >>> ?? >>> >>> >>> On Thu, Mar 7, 2013 at 11:01 AM, Niphlod <[email protected]> wrote: >>> >>>> when you process a form, request.vars holds the POSTed values of the >>>> form. What you're experiencing is that fk_id is yet in request.vars because >>>> it's a var originated by the GET of the page holding the form. Either you >>>> use a different variable in the GET request (e.g. /app/controller/function? >>>> **whatever=1) and use db.table.fk_id.default = request.vars.whatever >>>> or you treat the [1,1] as 1 before it's submitted to the db. >>>> Generally speaking changing the GET var name is the "recommended" way. >>>> >>>> >>>> On Thursday, March 7, 2013 4:56:13 PM UTC+1, Richard wrote: >>>>> >>>>> Hello, >>>>> >>>>> Here my problem I want to pass field default form value by the url to >>>>> like this : >>>>> >>>>> http://127.0.0.1:8000/appname/****controller/func?fk_id=1<http://127.0.0.1:8000/appname/controller/func?fk_id=1> >>>>> >>>>> Then in controller I do : >>>>> >>>>> db.table.fk_id.default=**request**.vars.fk_id >>>>> ... >>>>> if form.accepts(request.vars, session): >>>>> # HERE IT FAILED BECAUSE form.vars.fk_id = to ['1', '1'] instead >>>>> of just '1' >>>>> >>>>> Since form.accepts request.vars, then form.vars.fk_id get value from >>>>> the form field and the url vars that I pass... >>>>> >>>>> What the proper way to avoid that?? >>>>> >>>>> Should I use an other variable name in my URL?? >>>>> >>>>> I get this behavior in web2py 2.3.2 in case there is a issue there... >>>>> >>>>> Richard >>>>> >>>>> >>>>> -- >>>> >>>> --- >>>> 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+un...@**googlegroups.com. >>>> >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> >>> >> -- > > --- > 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. > > > -- --- 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.

