Developer manual
search
Customise the search form
Updated: Type: springtag
Method
<search option="value"/>
Used in conjunction with the <searchresults/> springtag
Current
Request Attributes
Attribute | Type | Description | Default | Required? | |
---|---|---|---|---|---|
current | button-label | string | The text for the button. | Search | No |
current | type | option | The type of button used. Allowed values: input, button |
input | No |
current | search-field | string | The field to search. The 'xml' field is the container tag for all form fields for a page. Therefore the default is to search all fields. |
xml | No |
current | search-field-class | string | Additional class to add to the search 'input' field. | field | No |
current | search-field-label | string | Value of the the html 'label' tag to be added before the 'input' field. If no 'search-field-label' is specified, no html label tag is output. |
No | |
current | label-class | string | Additional class to add to the search field label. | label | No |
current | result-path | string | The path used to display the search results Allowed values: Path must be a valid spring url |
:view:search | No |
current | result-sort | option | Display the results according to date, title or relevance Allowed values: date title relevance Relevance is based on the number of 'matches' a document has. |
relevance | No |
current | placeholder | string | String to display as the html5 placeholder (i.e. in-field-label). | No |
Examples
#1
Request
<search/>
Default request
Response
<form action="/utils/redirect.php" id="search" method="post"> <p> <input name="url" type="hidden" value="/view/search/query" /> </p> <p> <input type="hidden" name="querypath" value="true" /> </p> <p> <input id="xml" name="xml" type="text" class="field" /> <input class="button" type="submit" value="Search" /> </p> </form>
#2
Request
<search type="button"/>
Using a 'button' element instead of the default 'input'
Response
<form action="/utils/redirect.php" id="search" method="post"> <p> <input name="url" type="hidden" value="/view/search/query" /> </p> <p> <input type="hidden" name="querypath" value="true" /> </p> <p> <input id="xml" name="xml" type="text" class="field" /> <button class="button" type="submit"> <span class="label">Search</span> </button> </p> </form>