|
|
|
Description
Provides a HTML checkbox form element <input type="checkbox">.
The Checkbox component must be wrapped by a Form.
|
See Also
Form, Radio,
RadioGroup
|
Parameters
Name |
Type |
Direction |
Required |
Default |
Description |
selected |
boolean |
in-out |
yes |
|
Indicates whether the checkbox is selected or not.
Corresponds to the "checked" HTML attribute.
|
disabled |
boolean |
in |
no |
false |
Controls whether the text field is active or not. If disabled, then
any value that comes up when the form is submitted is ignored.
Corresponds to the "disabled" HTML attribute.
|
Body: removed Informal parameters:
allowed
Reserved parameters:
"type", "checked", "name"
|
Examples
Provides a checkbox for the user contact a sales representative.
<form jwcid="enquiryForm">
<input type="checkbox" jwcid="contactRepCheckbox"/> Contact Sales Rep
</form>
<component id="enquiryForm" type="Form">
<binding name="listener" expression="listeners.formSubmit"/>
</component>
<component id="contactRepCheckbox" type="Checkbox">
<binding name="selected" expression="contactRep"/>
<binding name="disabled" expression="staff"/>
</component>
public class EnquiryPage extends BasePage {
private boolean contactRep;
private boolean isStaff;
public boolean getContactRep() { return contactRep; }
public void setContactRep(boolean value) {
contactRep = value;
fireObservedChange("contactRep", contactRep);
}
public boolean isStaff() { return isStaff; }
public void detach() {
contactRep = false;
isStaff = false;
super.detach();
}
public void formSubmit(RequestCycle cycle) {
if (getContactRep()) {
// Process contact a sales representative request
}
}
}
|