don't have the time to fully test it , but process() or validate() consider 
only request.post_vars by default

https://github.com/web2py/web2py/blob/master/gluon/html.py#L2103

so, try as villas says (explicitely passing request.vars to an accept() ) 
or use form.validate(request_vars=request.vars, keepvalues=True) (again, 
didn't test it, but watching at the code it **should** work)

On Monday, April 29, 2013 5:56:46 PM UTC+2, villas wrote:
>
> Also try this:
>
> if form.accepts(request.vars,keepvalues=True,dbio=False):
>
>
> I also think the syntax you suggested should have worked,  but I don't 
> know why...
>
>
>
>
> On Monday, April 29, 2013 10:53:48 AM UTC+1, Domagoj Kovač wrote:
>>
>> Hi, 
>>
>> In my grid i have a search form that filters grid results.
>> Is it possible to have SQLFORM.factory to have _method=GET and to keep 
>> values on form.validate:
>>
>> Something like:
>>     fields = []
>>
>>     fields.append(Field("asset_id",
>>                         requires=IS_EMPTY_OR(IS_IN_DB(db, 'asset.id', 
>> '%(asset_label)s', zero=T("-- Odaberite --"))),
>>                         label=LABEL("Imovina", 
>> _for="event_value_asset_id")))
>>
>>     fields.append(Field("event_class_id",
>>                         requires=IS_IN_DB(db, 'event_class.id', 
>> '%(name)s', zero=T("-- Odaberite --")),
>>                         label=LABEL("Vrsta događaja", 
>> _for="event_value_event_class_id")))
>>
>>     form = SQLFORM.factory(*fields, _method='GET')
>>
>>     if form.validate(keepvalues=True):
>>         search = True #this i just a code example
>> Above code doesn't work, do i need to set form.vars manually?
>>
>

-- 

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