dojo.provide("dojo.widget.Checkbox");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.event.*");
dojo.require("dojo.html.style");
dojo.require("dojo.html.selection");
dojo.widget.defineWidget(
"dojo.widget.Checkbox",
dojo.widget.HtmlWidget,
{
// summary
// Same as an HTML checkbox, but with fancy styling
templatePath: dojo.uri.moduleUri("dojo.widget", "templates/Checkbox.html"),
templateCssPath: dojo.uri.moduleUri("dojo.widget", "templates/Checkbox.css"),
// name: String
// name used when submitting form; same as "name" attribute or plain HTML elements
name: "",
// id: String
// id attached to the checkbox, used when submitting form
id: "",
// checked: Boolean
// if true, checkbox is initially marked turned on;
// in markup, specified as "checked='checked'" or just "checked"
checked: false,
// tabIndex: Integer
// order fields are traversed when user hits the tab key
tabIndex: "",
// value: Value
// equivalent to value field on normal checkbox (if checked, the value is passed as
// the value when form is submitted)
value: "on",
postMixInProperties: function(){
dojo.widget.Checkbox.superclass.postMixInProperties.apply(this, arguments);
// set tabIndex="0" because if tabIndex=="" user won't be able to tab to the field
if(!this.disabled && this.tabIndex==""){ this.tabIndex="0"; }
},
fillInTemplate: function(){
this._setInfo();
},
postCreate: function(){
// find any associated label and create a labelled-by relationship
// assumes rather than
//
var notcon = true;
this.id = this.id !="" ? this.id : this.widgetId;
if(this.id != ""){
var labels = document.getElementsByTagName("label");
if (labels != null && labels.length > 0){
for(var i=0; i