AdvSearchForm
Last updated Nov 28th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn moreAdvSearchForm Snippet¶
This snippet displays a search form for AdvSearch.
Usage¶
Simply place wherever you want a SearchForm to render, and add the 'landing' property to the call to specify the Resource where the AdvSearch snippet call is located (which is where the results will display).
[[!AdvSearchForm? &landing=`82`]]
If you'd like the results to show on the same page, simply place the AdvSearch snippet call below the AdvSearchForm call, and don't specify a 'landing' parameter.
Available Properties¶
AdvSearch Features¶
To set or unset features.
Name | Description | Default |
---|---|---|
clearDefault | Clearing default text. Set this to 0 if you wouldn't like the clear default text feature. | 1 |
help | To add a help link near the search form. Set 1 (displayed) or 0 (hidden). | 1 |
Overall AdvSearch design¶
To design your own search.
Name | Description | Default |
---|---|---|
asId | Unique id for AdvSearch instance. Any combination of characters a-z, underscores, and numbers 0-9. Case sensitive. | as0 |
landing | The Resource that the AdvSearch snippet is called on, that will display the results of the search. | |
method | Whether to send the search over POST or GET. | GET |
searchIndex | The name of the REQUEST parameter that the search will use. | search |
toPlaceholder | Whether to set the output to directly return, or set to a placeholder with this propertys name. | |
tpl | The chunk that will be used to display the search form. | SearchForm |
Custom installation¶
The parameters that could help you for a custom installation.
Name | Description | Default |
---|---|---|
addJs | Set this to 1 if you would like to include the advsearchform.min.js file, 0 if not | 1 |
addCss | Set this to 1 if you would like to include the advsearch.css file, 0 if not | 1 |
addJQuery | Set this to 1 if you would like to include or not the jQuery library in the header of your pages automatically | 1 |
jsJQuery | Url where is located the jquery javascript library | assets/components/advsearch/js/jquery-1.5.1.min.js |
jsSearchForm | Url (under assets/) where is located the js library used with the form (help, clearDefault, ...) | assets/components/advsearch/js/advsearchform.min.js |
AdvSearchForm Chunks¶
There is 1 chunk that is processed in AdvSearchForm. Its corresponding AdvSearchForm parameter is:
- tpl - The Chunk to use for the search form.
Examples¶
Display the search form, without but search with POST instead of GET:
[[AdvSearchForm? &method=`POST`]]
Set the search form to a 'search.form' placeholder, specify a landing page on Resource 82, and use a custom Chunk called 'MySearchForm' for the form template:
[[AdvSearchForm? &tpl=`MySearchForm` &landing=`82` &toPlaceholder=`search.form`]]
<h2>Search</h2>
[[+search.form]]
Display two search forms, the first one (as0) without the help link and the second one (as1) without the clearDefault feature:
[[AdvSearchForm? &help=`0`]]
[[AdvSearchForm? &asId=`as1` &clearDefault=`0`]]
Errors¶
The following error message are possible:
- AdvSearch runs only with charset UTF-8.
- AdvSearch runs only with the multibyte extension on. See Lexicon and language system settings.
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn more