CheckboxView

The Checkbox view

Description

The Checkbox view displays a checkbox and returns a Boolean value indicating whether it is checked.

Documentation

Library path

Properties

Name

Default value

Description

id Required. The unique ID for this control.
defaultThe default value.
disabledfalseIndicates whether to disable the view.
valueThe Boolean value of the checkbox.

Methods

Name

Description

renderDraws the control to the screen. Called only when you create the control manually in JavaScript.
valReturns the view's value if passed no parameters. Sets the view's value if passed a single parameter.

Events

Name

Description

changeFired when the value of the view changes.

Example (Django tag)

{% checkbox id="example-checkbox" default=False %}

Example (JavaScript)

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

        // Instantiate components
        new CheckboxView({
            id: "example-checkbox",
            default: false,
            el: $("#mycheckboxview")
        }).render();

    });
</script>

Code examples