TextInputView

The TextInput view

Description

The TextInput view displays an editable text box.

Library path

Simple XML wrapper

Properties

Name

Default value

Description

id Required. The unique ID for this control.
defaultThe value to display on startup.
disabledfalseIndicates whether to disable the view.
initialValueThe initial value of the input. If defaultis specified, it overrides this value.
settingsThe properties of the view. See the methods below to get and set values.
type"text"The type of text field. To display characters as asterisks (*), set this value to "password".
valueThe value of the text field.

Methods

Name

Description

renderDraws the view to the screen. Called only when you create the view manually.
settings.get( property )Returns the value of property for the current component.
settings.set( propertyvalue )Sets the value of property to the specified value for the current component.
valReturns the view's value if passed no parameters. Sets the view's value if passed a single parameter.

Event

Name

Description

changeFired when the text value changes.

Example

require([
    "splunkjs/mvc",
    "splunkjs/mvc/textinputview",
    "splunkjs/mvc/simplexml/ready!"
], function(mvc, TextInputView) {

    // Instantiate components
    new TextInputView({
        id: "example-textinput",
        value: mvc.tokenSafe("$myTextValue$"),
        default: "type here",
        el: $("#mytextinputview")
    }).render();

});