web2py forms are typically self-submitting, meaning that the form is 
submitted to the same action (i.e., route) that generated it. This means 
you don't have to define and process the same form in two different 
functions. The question is whether you want the UI of the page to change 
when displaying the results vs. the form, or whether you actually want the 
URL of the results page to be different. If the former, all you need is 
some logic in the view to display either the form or the results, depending 
on whether there was a form submission. If the latter, you either need to 
(a) submit the form to a different action from the one that generated it, 
or (b) after processing the form, redirect to another action to generate 
the results (in which case, you will need to make the search query 
available to that second action, via query string or the session).

Because this is a search form, it probably makes more sense to submit via 
the GET method rather than the default POST, in which case, the query 
parameters will end up in the URL query string. You don't really need to 
process the form submission in that case, so you can simply submit the form 
to a different action. Something like:

def search_form():
    form = FORM(..., _method='GET', _action=URL('default', 'search_results'
))
    ...

def search_results():
    [extract query parameters from request.vars]
    ...

Anthony

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