diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index 6ae92639d..7e6be90dd 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -487,8 +487,8 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
}
// Attribute is read-only
- $sHTMLValue = $this->GetAsHTML($sAttCode);
- $sHTMLValue .= '';
+ $sHTMLValue = "".$this->GetAsHTML($sAttCode);
+ $sHTMLValue .= '';
$aFieldsMap[$sAttCode] = $sInputId;
$sComments = $sSynchroIcon;
}
diff --git a/application/wizardhelper.class.inc.php b/application/wizardhelper.class.inc.php
index ef121b698..befd88fbc 100644
--- a/application/wizardhelper.class.inc.php
+++ b/application/wizardhelper.class.inc.php
@@ -125,7 +125,7 @@ class WizardHelper
{
$oObj->Set(MetaModel::GetStateAttributeCode($this->m_aData['m_sClass']), $this->m_aData['m_sState']);
}
-
+ $oObj->DoComputeValues();
return $oObj;
}
diff --git a/pages/ajax.render.php b/pages/ajax.render.php
index eac393501..ae5124816 100644
--- a/pages/ajax.render.php
+++ b/pages/ajax.render.php
@@ -317,7 +317,7 @@ try
break;
case 'wizard_helper':
- $oPage->SetContentType('application/json');
+ $oPage->SetContentType('text/html');
$sJson = utils::ReadParam('json_obj', '', false, 'raw_data');
$oWizardHelper = WizardHelper::FromJSON($sJson);
$oObj = $oWizardHelper->GetTargetObject();
@@ -335,17 +335,27 @@ try
$sId = $oWizardHelper->GetIdForField($sAttCode);
if ($sId != '')
{
- // It may happen that the field we'd like to update does not
- // exist in the form. For example, if the field should be hidden/read-only
- // in the current state of the object
- $value = $oObj->Get($sAttCode);
- $displayValue = $oObj->GetEditValue($sAttCode);
- $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
- $iFlags = MetaModel::GetAttributeFlags($sClass, $oObj->GetState(), $sAttCode);
- $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $value, $displayValue, $sId, '', $iFlags, array('this' => $oObj, 'formPrefix' => $sFormPrefix));
- // Make sure that we immediatly validate the field when we reload it
- $oPage->add_ready_script("$('#$sId').trigger('validate');");
- $oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
+ $iFlags = $oObj->GetAttributeFlags($sAttCode);
+ if ($iFlags & OPT_ATT_READONLY)
+ {
+ $sHTMLValue = "".$oObj->GetAsHTML($sAttCode);
+ $sHTMLValue .= '';
+ $oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
+ }
+ else
+ {
+ // It may happen that the field we'd like to update does not
+ // exist in the form. For example, if the field should be hidden/read-only
+ // in the current state of the object
+ $value = $oObj->Get($sAttCode);
+ $displayValue = $oObj->GetEditValue($sAttCode);
+ $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
+ $iFlags = MetaModel::GetAttributeFlags($sClass, $oObj->GetState(), $sAttCode);
+ $sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $value, $displayValue, $sId, '', $iFlags, array('this' => $oObj, 'formPrefix' => $sFormPrefix));
+ // Make sure that we immediately validate the field when we reload it
+ $oPage->add_ready_script("$('#$sId').trigger('validate');");
+ $oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
+ }
}
}
$oPage->add_script("oWizardHelper{$sFormPrefix}.m_oData=".$oWizardHelper->ToJSON().";\noWizardHelper{$sFormPrefix}.UpdateFields();\n");