<txp:search_input /> single tag, 6 attributes


The search_input tag is a single tag. This tag will provide a text entry field for search parameters and an optional button to initiate the search.


  • Use the specified section as the destination page that will display the search results.
  • The HTML id attribute assigned to the search form.
  • Creates and labels a button to initiate the search.
  • Sets the size of the text field.
  • Use specified form. (Yes, a TXP-form to build a customized X/HTML form.)
  • Values
    • exact : search terms must exactly match the words in the article in the order given. This mode is also automatically selected if the search term is surrounded with double quotes
    • any : any of the search terms in an article will cause it to show up in the results
    • all : all of the search terms in the article must exist (in any order) for the article to be included in the results


  • Label prepended to item (or as first list item, where appropriate).
  • if wraptag is available and is set to ol or ul, the label will be the first list item.
  • (X)HTML tag (without brackets) to wrap around the list.
  • (X)HTML class attribute to apply to the wraptag.


Version 4.3.0

  • match attribute added

Version 4.0.7

  • html_id attribute added.
<txp:search_input /> 2 examples

Display a search input form

<txp:search_input label="Search" button="Search" size="20" wraptag="div" />

Elements required for building a customized (X)HTML search form

You can build your own custom search form (in a TXP form, like you do with e.g. the article tag) by specifying form=“txpformname” inside the <txp:search_input /> tag.

The following is the content of txpformname and shall depict the absolute minimum of tags and attributes required:

<form action="<txp:site_url />">
<input type="text" name="q" />

If you use a customized TXP form, Textpattern doesn’t automatically wrap the (X)HTML form output with form tags, so you need a pair of those to enclose your code. The name=“q” attribute/value pair inside the text input tag is required for even initiating a search query.

Textpattern, as of this writing, will use a user defined form named search_results, or an internally defined default form if no search result form is defined by you.

Other tags used: site_url