Pre-populating - means just default values  which will be overwritten 
during form.process(), i.e.  form.process() reads vars values only from 
request.*post_*vars  or from 'vars' arg  - form.process(vars = {...} ) and 
ignores  pre-sets like form.vars.name=... 

There was a mistake in my  post: instead  request.vars  must be request.
*post_*vars -   I fixed this 

On Sunday, January 22, 2017 at 12:48:45 PM UTC+3, Dave S wrote:
>
>
>
> On Friday, January 20, 2017 at 9:23:37 AM UTC-8, Val K wrote:
>>
>> form.vars appear only after form.process()  call (process() - 
>> filter/convert/format/validate request.vars to form.vars)
>> you have variants :
>> 1. *before *form creation  - modify field.default
>> 2. *before* form.process()  -  modify request.vars - 
>> request.vars.PostDate=... 
>> 3. pass your own set of vars  -  form.process(vars=myvars)
>> 4. use form.process( onvalidation=myvalidation_fun) to modify form.vars  
>> *after 
>> *basic validation passed but before any db actions
>>  
>>  
>>
>>
> But what about this passage in the book?
>
> <URL:
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Pre-populating-the-form
> >
> Pre-populating the form
>
> It is always possible to pre-populate a form using the syntax:
>
> 1
>
> form.vars.name = 'fieldvalue'
>
> Statements like the one above must be inserted after the form declaration 
> and before the form is accepted, whether or not the field ("name" in the 
> example) is explicitly visualized in the form.
>

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

Reply via email to