diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index ba730e766..7b8bbcfbf 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -2330,36 +2330,41 @@ class XmlForm_Field_Checkbox extends XmlForm_Field */ function render($value = NULL, $owner = NULL) { - if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { + if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { $value = $this->getPMTableValue($owner); } + + $disabled = ''; if($this->readOnly==='readonly' or $this->readOnly==='1' ){ - $disabled = "disabled"; + $readOnly = 'readonly="readonly" onclick="javascript: return false;"';//$disabled = "disabled"; } else{ - $disabled = ''; - } + $readOnly = ''; + } + $checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : ''; + if ($this->mode === 'edit') { //$readOnly = isset ( $this->readOnly ) && $this->readOnly ? 'disabled' : ''; if ($this->labelOnRight) { - $res = "readOnly $disabled>" . $this->label . ''; + $res = "" . $this->label . ''; } else { - $res = "readOnly $disabled/>"; + $res = ""; } $res .= $this->renderHint(); // $res = "" . $this->label ; return $res; } elseif ($this->mode === 'view') { + $checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : ''; if ($this->labelOnRight) { $html = ''; - $html = " + $html = " " . $this->label . ''; } else { - $html = ""; + $html = ""; } - $html .=""; + $html .= ""; // if($this->hint){ // $html .= ' //