The Search Text Box Object

Search text box is used to fetch (search) data that matches text entered in the text box from server and to return these data as XML document. You may view search result in Table or Media List objects.

var tbSearch = new TSearchTextBox('images/Search.png', 200, 'Search.php', onSearchDone);
var wndSearchTextBoxSample = createWindow('Search Text Box Sample');

onSearchDone = function(xmlDoc) {
    // Read data from xmlDoc
};

wndSearchTextBoxSample.add(tbSearch);
showModal(wndSearchTextBoxSample);

Search text box object constructor takes four parameters:

new TSearchTextBox(iconUrl, width, url, callback);

Where:

Data Structure

Data returned from the server depends on what you will do with it. If you want to pass them to Table object it must be structured in a way that table object can read it.

Data sent to the server have specific structure. It contains data you may use at your server script. Data contains session id if you define it in the g_sessionId variable and text entered in the text box.

Data Structure To Server:

<Vtf>
    <SessionId>This tag will be passed only if you define g_sessionId variable</SessionId>
    <SearchPhrase>Text</SearchPhrase>
</Vtf>
Search text box Methods and Properties
Method/Property Description
disable Disables the search text box object
enable Enables the search text box object
getText Gets text entered in the search text box object
setBackground Sets search text box background color. Form:
setBackground(color)
setFocus Sets focus on the search text box object. Form: setFocus()
setMaxLength Sets max length of characters entered in the text box. Form:
setMaxLength(maxLen)
setText Sets text in the text box. Form:
setText(text)