You can do:

form = SQLFORM.factory(
        Field('name', 'string'), ...)
form.vars.name = 'John'
form.process()

Note, you have to set form.vars before calling form.process().

Anthony

On Sunday, December 29, 2013 5:00:16 AM UTC-5, User wrote:
>
> I'm creating a form that is not based on a database table.  I understand I 
> can add a default to a field created with SQLFORM.factory, for example:
>
>     form = SQLFORM.factory(
>         Field('name', 'string', default='John'),
>         ...
>
> is it possible to specify a default after the above statement has 
> executed?  For example something like this:
>
>     form = SQLFORM.factory(
>         Field('name', 'string'),
>         ...
>     form.something.name.default = 'John'
>
> Or is the only way to specify a default in the Field constructor?  The 
> reason I ask is because I have some logic involved in determining the 
> default value (of course I can think of a workaround but I'm just curious)
>   
>
>

-- 
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.

Reply via email to