search_form
Table of contents
Renders a form with a text input as a search form. The first argument must be the query flag that is used to send the search query with as URL parameter.
Also accepts the following arguments:
url
: The URL to show the search results on (Optional, default: current url)form_class
: The html class for the search form tag. (Optional)Every other key-value argument will be used as html tags for the input.
The following generates a GET request for the search page '/search'.
When submitted, the search form makes a GET request to the following url: '/search?q=<search query>'.
💡 You can also easily create your own form, as long as the page your action points to has asearch_results
tag and uses the query object parameter to populate the search string.