Index: core/admin_templates/js/ajax.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/admin_templates/js/ajax.js (revision 15908) +++ core/admin_templates/js/ajax.js (revision ) @@ -390,10 +390,21 @@ } AjaxDropdownPreloader.prototype.getControl = function($field) { - var $id = this.InputMask.replace('#FIELD#', $field); - return document.getElementById($id); + var $mask = this.InputMask.replace('#FIELD#', '#FIELD_NAME#'); + + if ( $field == this.DependendField ) { + var $control = get_control($mask, $field); + + if ( $control.tagName.toUpperCase() == 'SELECT' ) { + return $control; -} + } + return get_control($mask, $field, 'select'); + } + + return get_control($mask, $field); +} + AjaxDropdownPreloader.prototype.successCallback = function($request, $params, $object) { if (Request.processRedirect($request) === true) { return ; @@ -409,17 +420,28 @@ var $child = $node.childNodes.item(i); switch ($child.tagName) { case 'option': - var opt_value = $child.getAttribute('value'); - var title; - if (opt_value) { // value is passed explicically + var title, + $is_selected = false, + opt_value = $child.getAttribute('value'); + + if (opt_value) { // value is passed explicitly title = $child.firstChild.nodeValue } else { opt_value = $child.firstChild.nodeValue; title = this.Titles[$child.firstChild.nodeValue]; } + this.addOption($dst_field, opt_value, title, $child.attributes); - if (!$dst_field.multiple && (opt_value == $selected_value)) { + + if ( $dst_field.multiple ) { + $is_selected = $selected_value.indexOf('|' + opt_value + '|') != -1; + } + else { + $is_selected = opt_value == $selected_value; + } + + if ($is_selected) { $dst_field.options[$dst_field.options.length - 1].selected = true; } break; \ No newline at end of file