At some point, you have to call form.process(request_vars=request.get_vars) 
if you want your form.vars assignments to get added to the form widgets 
(call it after all the assignments). You need to do that for validation 
anyway.

Anthony

On Friday, May 3, 2013 5:40:07 AM UTC-4, Domagoj Kovač wrote:
>
> Hi,
>
> i have a form like this.
>
>         fields.append(Field("date_from", "date",
>                             requires=IS_DATE(),
>                             label=LABEL("Datum od", _for=
> "no_table_date_from")))
>
>         fields.append(Field("date_to", "date",
>                             requires=IS_DATE(),
>                             label=LABEL("Datum do", _for=
> "no_table_date_to")))
>
>         fields.append(Field("location_id", "reference asset_location",
>                             required=True,
>                             requires=IS_NULL_OR(IS_IN_DB(db, '
> asset_location.id', '%(name)s', zero=T("Molimo odaberite lokaciju"))),
>                             label=LABEL("Lokacija", _for=
> "no_table_location_id")))
>
>         fields.append(Field("repeated", "boolean",
>                             label=LABEL("Ponovljene", _for=
> "no_table_repeated")))
>
>         form = SQLFORM.factory(*fields, _method="GET")
>
> and then i have:
>
>         if request.get_vars.date_from or request.get_vars.date_to:
>
>             query &= (db.asset_value.asset_attribute_id == 27)
>
>             if request.get_vars.date_from:
>                 query &= (db.asset_value.date_value > request.get_vars.
> date_from)
>                 form.vars.date_from = request.get_vars.date_from
>
>             if request.get_vars.date_to:
>                 query &= (db.asset_value.date_value < request.get_vars.
> date_to)
>                 form.vars.date_from = request.get_vars.date_from
>
>         if request.get_vars.location_id:
>             query &= (db.asset_value.location_value == request.get_vars.
> location_id)
>             form.vars.location_id = request.get_vars.location_id
>
>         if request.get_vars.repeated:
>             query &= (db.asset_value.boolean_value == request.get_vars.
> repeated)
>             form.vars.repeated = request.get_vars.repeated
>
> Queries are fine and they work, but form.vars are always empty, does that 
> have anything to do with form type being GET?
>

-- 

--- 
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/groups/opt_out.


Reply via email to