Index: branches/5.3.x/core/admin_templates/js/ajax.js =================================================================== diff -u -N -r15902 -r15961 --- branches/5.3.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15902) +++ branches/5.3.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15961) @@ -390,8 +390,19 @@ } 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) { @@ -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;