Deprecated
SearchController object methods are deprecated, we recommend using Search API instead.
Adds a field to the search panel. Then calls the callback function, passing the SearchField object of an added field as the argument. In the callback function, you can use all the functionality available for the SearchField object.
Syntax
srch.addField(fieldName, callback(field))
Arguments
fieldName
the name of the field. Example: 'Make'.
callback(field)
a call to a callback function. field is the SearchField object of an added field. This argument may be omitted.
Return value
No return value.
Example 1
Add the Make field to the search panel using the JavaScript OnLoad event:
var srch = pageObj.getSearchController();
srch.addField('Make');
Example 2
Add the Price field to the search panel and set search parameters using the JavaScript OnLoad event:
var srch = pageObj.getSearchController();
srch.addField('Price', function( field ) {
field.getControl().setValue("20000");
field.setOption(Runner.search.options.LESS_THAN);
});
See also:
•JavaScript API: Control object > setValue()
•JavaScript API: SearchField object > setOption()
•JavaScript API: SearchField object
•JavaScript API: SearchController object (deprecated)