CheckBox

From WebOS101

Jump to: navigation, search

Contents

Introduction

The CheckBox widget to present a binary choice to a user. See also ToggleButton.

Creating a CheckBox

HTML

<div x-mojo-element="CheckBox" id="checkboxId" class="checkboxClass" name="checkboxName"></div>
Properties Required Value Description
x-mojo-element Required CheckBox Declares the widget as type 'CheckBox'
id Required Any String Identifies the widget element for use when instantiating or rendering.

Events

Mojo.Event.listen(this.controller.get("checkboxId"), Mojo.Event.propertyChange, this.handleUpdate);
Event Type Value Event Handling
Mojo.Event.propertyChange none Sends an event with the added properties 'model' and 'value'; Model is the model supplied when the application first set up the widget with a value updated to reflect the state of the checkbox; value represents the current value of the checkbox regardless of model.

Instantiation

this.controller.setupWidget("checkboxId",
this.attributes = {
trueValue: "On",
falseValue: "Off"
},
this.model = {
value: false,
disabled: false
}
);

Attributes

Attribute Property Type Required Default Description
modelProperty String Optional "value" Model property name for checkbox state.
disabledProperty String Optional "disabled" Model property name for disabled boolean.
trueValue String Optional true Value to set model property when true.
falseValue String Optional false Value to set model property when false.
fieldName String Optional none DEPRECATED Idenitifer for the value of the checkbox; used when the checkbox is used in html forms.
inputName String Optional none Idenitifer for the value of the checkbox; used when the checkbox is used in html forms.

Model Properties

Model Property Type Required Default Description
value User-defined Required none Current value of widget.
disabled Boolean Optional false If true, checkbox is inactive.

Methods

The CheckBox widget does not have any methods.

Useful Resources

Palm Developer Center - CheckBox

Personal tools