Search Forms
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
Search forms are blocks that contain an input field and a submit button. They send a request to the search results page.
The scenario is meant for sites with many pages, where searching is easier for a visitor than browsing the menu. The form block is placed in the header, in a sidebar, or in a dedicated section of a knowledge base or an online store. If there are few pages, search is replaced with a menu or navigation.
Such blocks are described with the search subtype and the type: form parameter in the block manifest. The subtype does one thing: it fills the form with the link to the results page.
Requirements for the Block to Function
The minimum requirements are:
<form>tag- Input field for the search query
- Submit button for the form
actionattribute configured through the attrs key of the manifest
Example of the form attribute description:
'attrs' => [
'.landing-block-node-form' => [
'name' => 'Search result page',
'attribute' => 'action',
'type' => 'url',
'allowedTypes' => [
'landing',
],
'disableCustomURL' => true,
'disallowType' => true,
'disableBlocks' => true,
],
],
In standard blocks, the action attribute is set for the selector .landing-block-node-form. The keys of the example:
type: url— a link selection field in the editorattribute: action— the DOM attribute the link is retained inallowedTypes: ['landing']— restricts the choice to site pagesdisableCustomURL,disallowType,disableBlocks— prohibit entering an address manually, changing the link type, and selecting a block
The common attribute fields and their types are covered in the Attributes article.
How subtype: search Works
Example of the subtype description:
'block' => [
'subtype' => 'search',
'subtype_params' => [
'type' => 'form',
'resultPage' => 'search-result',
],
],
After adding the block, the system:
- Searches the current site for a page with the template
search-result - If the page is found, it substitutes it into
action - If the page is not found, it creates it based on the template and then substitutes it into
action
Subtype parameters:
|
Parameter |
What It Defines |
|
|
The role of the block in the search scenario. Only one value is supported — |
|
|
The template code of the results page. The system uses it to look for a page on the current site in the |
To substitute the link, the system looks in the manifest for an attribute with type: url and attribute: action. The value found is recorded in the #landing<ID> format, where ID is the identifier of the results page.
Examples of Standard Blocks
59.1.search59.2.search_sidebar59.3.search_dark
How to Build Your Own Form Block
- Review the manifest of a standard block using the landing.block.getmanifestfile method, passing a block code from the list above.
- Describe
subtype: searchwith thetype: formandresultPageparameters in your own manifest, together with theactionattribute for the form selector. - Register the block using the landing.repo.register method, passing the manifest in the
manifestparameter. - Add the block to a page using the landing.landing.addblock method. The system substitutes the link to the results page at this step.
- Check the attribute value using the landing.block.getcontent method with the
editMode = trueparameter — without it, the published version of the block is returned. To point to a different page, record it using the landing.block.updateattrs method.
Permissions and Limitations
Scope:
landingWho can execute the method: depending on the method
Limitations:
- the subtype fires once, when the block is added to a page. For blocks already placed on a page, the link in
actionis not updated - only a page of the current site can be substituted into
action: an arbitrary URL and block binding are disabled for this attribute - if
resultPageis not specified, the results page is not substituted. It is selected manually in the block settings or recorded using the landing.block.updateattrs method - when a site configuration is transferred between Bitrix24 accounts, the manifest preparation is not performed, so the results page is not created
- the standard form blocks are intended for sites of the
knowledgeandgrouptypes - the subtype is responsible only for the link in the form. What to configure on the results page itself is described in the Search Results article