2929import ('form.FormElement ' );
3030
3131class Checkbox extends FormElement {
32- var $ mChecked = false ;
32+ var $ checked = false ;
3333 var $ mOptions = null ;
3434
3535 function __construct ($ name , $ value = '' ) {
@@ -38,27 +38,28 @@ function __construct($name, $value = '') {
3838 $ this ->value = $ value ;
3939 }
4040
41- function setChecked ($ value ) { $ this ->mChecked = $ value ; }
42- function isChecked () { return $ this ->mChecked ; }
41+ function setChecked ($ value ) { $ this ->checked = $ value ; }
42+ function isChecked () { return $ this ->checked ; }
4343
4444 function setData ($ value ) { $ this ->mOptions = $ value ; }
4545 function getData () { return $ this ->mOptions ; }
46-
47- function getHtml () {
4846
49- if ($ this ->id =="" ) $ this ->id = $ this ->name ;
50-
51- $ html = "\n\t<input type= \"checkbox \"" ;
52- $ html .= " name= \"$ this ->name \" id= \"$ this ->id \"" ;
47+ function getHtml () {
48+ if ($ this ->id == '' ) $ this ->id = $ this ->name ;
49+
50+ $ html = "\n\t<input type= \"checkbox \"" ;
51+ $ html .= " id= \"$ this ->id \" name= \"$ this ->name \"" ;
52+
53+ if ($ this ->checked || (($ this ->value == $ this ->mOptions ) && ($ this ->value != null )))
54+ $ html .= " checked= \"true \"" ;
5355
5456 if ($ this ->on_change !="" )
5557 $ html .= " onchange= \"$ this ->on_change \"" ;
5658
5759 if ($ this ->style !="" )
5860 $ html .= " style= \"$ this ->style \"" ;
5961
60- if ($ this ->mChecked || (($ this ->value == $ this ->mOptions ) && ($ this ->value != null )))
61- $ html .= " checked= \"true \"" ;
62+
6263
6364 if (!$ this ->isEnabled ())
6465 $ html .= " disabled= \"disabled \"" ;
0 commit comments