BUG 7872 problema resuelto con los checks en modo view y readonly.

This commit is contained in:
Alvaro Campos
2011-10-18 17:44:51 -04:00
parent 08af9965e4
commit 289b906cbd

View File

@@ -2333,33 +2333,38 @@ class XmlForm_Field_Checkbox extends XmlForm_Field
if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) {
$value = $this->getPMTableValue($owner); $value = $this->getPMTableValue($owner);
} }
$disabled = '';
if($this->readOnly==='readonly' or $this->readOnly==='1' ){ if($this->readOnly==='readonly' or $this->readOnly==='1' ){
$disabled = "disabled"; $readOnly = 'readonly="readonly" onclick="javascript: return false;"';//$disabled = "disabled";
} }
else{ else{
$disabled = ''; $readOnly = '';
} }
$checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : ''; $checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : '';
if ($this->mode === 'edit') { if ($this->mode === 'edit') {
//$readOnly = isset ( $this->readOnly ) && $this->readOnly ? 'disabled' : ''; //$readOnly = isset ( $this->readOnly ) && $this->readOnly ? 'disabled' : '';
if ($this->labelOnRight) { if ($this->labelOnRight) {
$res = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked readonly=$this->readOnly $disabled><span class='FormCheck'>" . $this->label . '</span></input>'; $res = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked $readOnly $disabled><span class='FormCheck'>" . $this->label . '</span></input>';
} else { } else {
$res = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked readonly=$this->readOnly $disabled/>"; $res = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked $readOnly $disabled/>";
} }
$res .= $this->renderHint(); $res .= $this->renderHint();
// $res = "<input id='form[" . $this->name . "]' value='" . $this->name . "' name='form[" .$this->name . "]' type='checkbox' $checked $readOnly >" . $this->label ; // $res = "<input id='form[" . $this->name . "]' value='" . $this->name . "' name='form[" .$this->name . "]' type='checkbox' $checked $readOnly >" . $this->label ;
return $res; return $res;
} elseif ($this->mode === 'view') { } elseif ($this->mode === 'view') {
$checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : '';
if ($this->labelOnRight) { if ($this->labelOnRight) {
$html = ''; $html = '';
$html = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked readonly='{$this->readOnly}' $disabled > $html = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked $readOnly $disabled >
<span class='FormCheck'>" . $this->label . '</span></input>'; <span class='FormCheck'>" . $this->label . '</span></input>';
} else { } else {
$html = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked readonly='{$this->readOnly}' disabled/>"; $html = "<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='checkbox' $checked $readOnly disabled/>";
} }
$html .="<input id='form[" . $this->name . "]' value='{$this->value}' name='form[" . $this->name . "]' type='hidden' />"; $html .= "<input id='form[" . $this->name . "]' value='{$value}' name='form[" . $this->name . "]' type='hidden' />";
// if($this->hint){ // if($this->hint){
// $html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;"> // $html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
// <image src="/images/help4.gif" width="15" height="15" border="0"/> // <image src="/images/help4.gif" width="15" height="15" border="0"/>