Default token values

Some Splunk views can take a default value to define the initial value of the view. If the view's value is a token, the token will be initially set to the default value. In this example, the initial value for both the text box and dropdown list is "Top five sourcetypes":

new TextInputView({
    id: "txtSavedSearch",
    value: mvc.tokenSafe("$savedSearch$"),
    default: "Top five sourcetypes",
    el: $("#textbox_SavedSearch")
}).render();

new DropDownView({
    id: "selSavedSearch",
    value: mvc.tokenSafe("$savedSearch$"),
    el: $("#dropdown_SavedSearch")
}).render();

If multiple views are linked to the same token, and multiple default values are specified, the last value that is set is the one that is used. In this example, the initial value for both views is "Errors in the last hour":

new TextInputView({
    id: "txtSavedSearch",
    value: mvc.tokenSafe("$savedSearch$"),
    default: "Top five sourcetypes",
    el: $("#textbox_SavedSearch")
}).render();

new DropDownView({
    id: "selSavedSearch",
    value: mvc.tokenSafe("$savedSearch$"),
    default: "Errors in the last hour",
    el: $("#dropdown_SavedSearch")
}).render();