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

@@ -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 = "<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 {
$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 = "<input id='form[" . $this->name . "]' value='" . $this->name . "' name='form[" .$this->name . "]' type='checkbox' $checked $readOnly >" . $this->label ;
return $res;
} elseif ($this->mode === 'view') {
$checked = (isset ( $value ) && ($value == $this->value)) ? 'checked' : '';
if ($this->labelOnRight) {
$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>';
} 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){
// $html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
// <image src="/images/help4.gif" width="15" height="15" border="0"/>