The "formargs" argument applies to the view, create, and update forms 
generated by the grid, not the search widget. But as long as you're 
creating a custom search form, why not just directly set keepvalues in the 
searchform() code?

Anthony

On Friday, March 30, 2018 at 4:05:32 PM UTC-4, Shrabya Timsina wrote:
>
> Thanks for clarifying Anthony, but I did try formargs in the ways you 
> suggested and did not get any values kept in the form after submission. 
> Here is my grid definition. I am using my own search_widget. Could that be 
> part of the problem?
>
>
> def searchform(fields, url):
>
>     family = Field("family", "string", required=False)
>     genus = Field("genus", "string", required=False)
>     species = Field("species_epithet", "string", required=False)
>     collector_number = Field("collector_number", "string", required=False)
>     form = SQLFORM.factory(
>         family, genus, species, collector_number,
>         _method='get', _action="#specimen_counter",
>         buttons = [TAG.button('Search',_type="submit", _class="btn 
> btn-success mr-4"),
>             TAG.button('Clear',_type="reset", _class="btn btn-default 
> btn-primary")])
>     return form
>
> grid = SQLFORM.grid(query=result_set, formargs={'keepvalues': True}, 
> fields=fields, headers=headers,
>             create=False, deletable=False, editable=False, links=links, 
> csv=False,
>             details=False, search_widget=searchform)
>
>
>
>

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