TextInputView

The TextInput view

Description

The TextInput view displays an editable text box.

Documentation

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.
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 in JavaScript.
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 (Django tag)

{% textinput id="example-textinput" value="$myTextValue$"|token_safe default="type here" %}

Example (JavaScript)

<script>
    var deps = [
        "splunkjs/ready!",
        "splunkjs/mvc/textinputview"
    ];
    require(deps, function(mvc) {
        var TextInputView = require("splunkjs/mvc/textinputview");

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

    });
</script>

Code examples