mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 09:08:42 +02:00
Fixed a regression: autocomplete not working due to a change in the execution of the script rendered in Ajax
SVN:trunk[168]
This commit is contained in:
@@ -645,13 +645,13 @@ abstract class cmdbAbstractObject extends CMDBObject
|
||||
//Enum field or external key, display a combo
|
||||
if (count($aAllowedValues) == 0)
|
||||
{
|
||||
$sHTMLValue = "<input type=\"text\" size=\"30\" value=\"\" name=\"attr_{$sAttCode}{$sNameSuffix}\" id=\"$iInputId\"{$sCSSClasses}/>";
|
||||
$sHTMLValue = "<input count=\"0\" type=\"text\" size=\"30\" value=\"\" name=\"attr_{$sAttCode}{$sNameSuffix}\" id=\"$iInputId\"{$sCSSClasses}/>";
|
||||
}
|
||||
else if (count($aAllowedValues) > 50)
|
||||
{
|
||||
// too many choices, use an autocomplete
|
||||
// The input for the auto complete
|
||||
$sHTMLValue = "<input type=\"text\" id=\"label_$iInputId\" size=\"30\" name=\"\" value=\"$sDisplayValue\"{$sCSSClasses}/>";
|
||||
$sHTMLValue = "<input count=\"".count($aAllowedValues)."\" type=\"text\" id=\"label_$iInputId\" size=\"30\" name=\"\" value=\"$sDisplayValue\"{$sCSSClasses}/>";
|
||||
// another hidden input to store & pass the object's Id
|
||||
$sHTMLValue .= "<input type=\"hidden\" id=\"$iInputId\" name=\"attr_{$sAttCode}{$sNameSuffix}\" value=\"$value\" />\n";
|
||||
$oPage->add_ready_script("\$('#label_$iInputId').autocomplete('./ajax.render.php', { minChars:3, onItemSelect:selectItem, onFindValue:findValue, formatItem:formatItem, autoFill:true, keyHolder:'#$iInputId', extraParams:{operation:'autocomplete', sclass:'$sClass',attCode:'".$sAttCode."'}});");
|
||||
|
||||
@@ -108,7 +108,7 @@ function WizardHelper(sClass)
|
||||
$('body').append(html);
|
||||
//console.log('data received:', oWizardHelper);
|
||||
//oWizardHelper.FromJSON(json_data);
|
||||
oWizardHelper.UpdateFields();
|
||||
//oWizardHelper.UpdateFields(); // Is done directly in the html provided by ajax.render.php
|
||||
//console.log(oWizardHelper);
|
||||
$('#wizStep'+ G_iCurrentStep).unblock( {fadeOut: 0} );
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ switch($operation)
|
||||
|
||||
$oWizardHelper->SetAllowedValuesHtml($sAttCode, $sHTMLValue);
|
||||
}
|
||||
$oPage->add("<script type=\"text/javascript\">\noWizardHelper.m_oData=".$oWizardHelper->ToJSON().";\n</script>\n");
|
||||
$oPage->add("<script type=\"text/javascript\">\noWizardHelper.m_oData=".$oWizardHelper->ToJSON().";\noWizardHelper.UpdateFields();\n</script>\n");
|
||||
break;
|
||||
|
||||
case 'ajax':
|
||||
|
||||
Reference in New Issue
Block a user