Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Checkboxes

tneil edited this page Jul 19, 2012 · 13 revisions

Checkboxes Checkboxes

Checkboxes are quite easy to use in bbUI. Simply add regular <input> elements of type="checkbox" and you are good to go

    <input type="checkbox" checked="true" value="one" onchange="doSomething(this)" />
    <input type="checkbox" value="two" onchange="doSomething(this)" />
    <input type="checkbox" value="three" onchange="doSomething(this)" />

When using BlackBerry 10 styling this control will be displayed according to the UI specifications found on BlackBerry 10. If you are using a checkbox input on BB6/BB7/PlayBook you will get the normal "Mozilla style" checkboxes.

When BlackBerry 10 styling is applied the highlight color of the checkbox will use the bb10HighlightColor provided in the toolkit init() function.

Note that any time the checkbox changes (either checked=true/false) the onchange event will be fired.

JavaScript Interface

NOTE: The javascript interface is currently only supported with BlackBerry 10 Styling

A Checkbox can have its value set using the setChecked() function that takes a boolean value for the state of the checkbox.

    document.getElementById('mycheckbox').setChecked(true);

The checked state can either be retrieved by examining the checked value of the checkbox or by using the getChecked() function

    alert(document.getElementById('mycheckbox').checked);
    alert(document.getElementById('mycheckbox').getChecked());
Clone this wiki locally