Since: SearchBuilder 1.0.0

Function to determine if the criteria is isInputValid.
Please note - this property requires the SearchBuilder extension for DataTables.


This function returns a boolean representing whether the criteria should be included or not. It takes 2 parameters.

This function gives access to the elements that have been created in the searchBuilder.conditions[type][cond].init function and the criteria instance that is currently being considered. The purpose of this function is to decide whether there is enough data present to include this criteria in the search filtering. It is not as straightforward as applying all of the filters all of the time. This is because when a new criteria is added the table would show no results.

Typically the jQuery elements will be used to decide if there is enough data there to proceed. For example select elements would need to have a selected option and input elements would need to have some text entered. If you always want a criteria with this condition to apply filtering no matter the value in the jQuery elements then just return true from this function. This will mainly be used when no jQuery elements are set, for example the empty condition.

The manual page for custom conditions covers in detail how this and the other values in this object come together to create a custom condition.

Some examples are shown below for select and input elements.


function searchBuilder.conditions[type][cond].isInputValid()


This function returns a boolean representing whether the criteria should be included or not.


Returns a boolean indicating whether the criteria is to be included in searching.


Select isInputValid function:

isInputValid (el, that) {
    // Deselect the placeholder
    $(that.dom.valueTitle).attr('selected', false);

    // Return true if there is a selected option
    return $(el[0]).has('option:selected').length >= 1

Input isInputValid function:

isInputValid (el, that) {
    // Return true if there is something present in the input element
    return $(el[0]).val().length > 0


The following options are directly related and may also be useful in your application development.