From 289b906cbd8b79565a577e15c08995568ecc4e11 Mon Sep 17 00:00:00 2001 From: Alvaro Campos Date: Tue, 18 Oct 2011 17:44:51 -0400 Subject: [PATCH] BUG 7872 problema resuelto con los checks en modo view y readonly. --- gulliver/system/class.xmlform.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 .= ' //