Skip to main content
NICE CXone Expert

We will be closed on Wednesday, December 25th in observance of Christmas

Expert Success Center

Search-In-Place Touchpoint Events

Applies to:
MindTouch (current)
Role required:
Admin

Events

mindtouch-web-widget:search:ready

Fired when the search widget is created. The event data contains the following properties:

Name Type
embedId string
 document.addEventListener('mindtouch-web-widget:search:ready', ({ data }) => {
    const embedId = data.embedId;
});

mindtouch-web-widget:search:loaded

Fired when the search widget is loaded. The event data contains the following properties:

Name Type
embedId string
widget.searchQuery string
widget.searchInput string|element
 document.addEventListener('mindtouch-web-widget:search:loaded', ({ data }) => {
    const embedId = data.embedId;
    
    // programmable widget interface contains properties and functions
    const widget = data.widget; 
});

mindtouch-web-widget:search:search-completed

Fires after a search has been completed, but before search results have been displayed. The event data contains the following properties:

Name Type
embedId string
results array<object>
document.addEventListener('mindtouch-web-widget:search:search-completed', ({ data }) => {
    const embedId = data.embedId;
    const results = data.results;
});

Properties

embedId

embedId : string

The id of the widget that uniquely identifies it.

searchQuery

searchQuery : string

Retrieve or set the search query value and perform a search. Set as a JavaScript object property or as a data-search-query data attribute on the mindtouch/embed script HTML element

document.addEventListener('mindtouch-web-widget:search:loaded', ({ data }) => {
    const widget = data.widget;
    widget.searchQuery = '{example-search-query}';
});
<script async="async" src="https://success.mindtouch.com/@embed/{guid}.js"></script>
<script type="mindtouch/embed" id="mindtouch-embed-{guid}" data-search-query="{example-search-query}"></script>

searchInput

searchInput : string|element

Retrieve or set the DOM element assigned to the search query input source. Any form input outside of the widget interface can be used to control the widget search behavior. This may be an element selector string or a DOM element. Set as a JavaScript object property or as a data-search-input data attribute (element selector string only) on the mindtouch/embed script HTML element.

document.addEventListener('mindtouch-web-widget:search:loaded', ({ data }) => {
    const widget = data.widget;
    
    // element selector string example
    widget.searchInput = '{example-selector}';
    
    // DOM element example
    widget.searchInput = document.querySelector('{example-selector}');
    
    // get the current search input element
    const foo = widget.searchInput;
});
<script async="async" src="https://success.mindtouch.com/@embed/{guid}.js"></script>
<script type="mindtouch/embed" id="mindtouch-embed-{guid}" data-search-input="{example-selector}"></script>

results

results : array<object>

A collection of search result objects.

document.addEventListener('mindtouch-web-widget:search:search-completed', ({ data }) => {
    data.results.forEach(result => {
        console.log(result.uri);
    });
});

 

  • Was this article helpful?