Couple of cleanups in RelatedObjectLookups.js
Thanks George Karpenkov.
This commit is contained in:
parent
a3242dc9fe
commit
828359e52d
|
@ -55,7 +55,7 @@ function dismissRelatedLookupPopup(win, chosenId) {
|
||||||
function showAddAnotherPopup(triggeringLink) {
|
function showAddAnotherPopup(triggeringLink) {
|
||||||
var name = triggeringLink.id.replace(/^add_/, '');
|
var name = triggeringLink.id.replace(/^add_/, '');
|
||||||
name = id_to_windowname(name);
|
name = id_to_windowname(name);
|
||||||
href = triggeringLink.href
|
var href = triggeringLink.href;
|
||||||
if (href.indexOf('?') == -1) {
|
if (href.indexOf('?') == -1) {
|
||||||
href += '?_popup=1';
|
href += '?_popup=1';
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,10 +73,11 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
|
||||||
newRepr = html_unescape(newRepr);
|
newRepr = html_unescape(newRepr);
|
||||||
var name = windowname_to_id(win.name);
|
var name = windowname_to_id(win.name);
|
||||||
var elem = document.getElementById(name);
|
var elem = document.getElementById(name);
|
||||||
|
var o;
|
||||||
if (elem) {
|
if (elem) {
|
||||||
var elemName = elem.nodeName.toUpperCase();
|
var elemName = elem.nodeName.toUpperCase();
|
||||||
if (elemName == 'SELECT') {
|
if (elemName == 'SELECT') {
|
||||||
var o = new Option(newRepr, newId);
|
o = new Option(newRepr, newId);
|
||||||
elem.options[elem.options.length] = o;
|
elem.options[elem.options.length] = o;
|
||||||
o.selected = true;
|
o.selected = true;
|
||||||
} else if (elemName == 'INPUT') {
|
} else if (elemName == 'INPUT') {
|
||||||
|
@ -88,8 +89,7 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var toId = name + "_to";
|
var toId = name + "_to";
|
||||||
elem = document.getElementById(toId);
|
o = new Option(newRepr, newId);
|
||||||
var o = new Option(newRepr, newId);
|
|
||||||
SelectBox.add_to_cache(toId, o);
|
SelectBox.add_to_cache(toId, o);
|
||||||
SelectBox.redisplay(toId);
|
SelectBox.redisplay(toId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue