From 688cd557086dcd7b497775765899559575de33a2 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 2 Jun 2006 17:53:00 +0000 Subject: [PATCH] Fixed #1635 -- Admin-site related-object popup no longer fails for edit_inline objects in IE/Win. Thanks, Christopher Lenz git-svn-id: http://code.djangoproject.com/svn/django/trunk@3066 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../contrib/admin/media/js/admin/RelatedObjectLookups.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/media/js/admin/RelatedObjectLookups.js b/django/contrib/admin/media/js/admin/RelatedObjectLookups.js index cb84790f44..cf57fc4dfb 100644 --- a/django/contrib/admin/media/js/admin/RelatedObjectLookups.js +++ b/django/contrib/admin/media/js/admin/RelatedObjectLookups.js @@ -3,6 +3,8 @@ function showRelatedObjectLookupPopup(triggeringLink) { var name = triggeringLink.id.replace(/^lookup_/, ''); + // IE doesn't like periods in the window name, so convert temporarily. + name = name.replace(/\./g, '___'); var href; if (triggeringLink.href.search(/\?/) >= 0) { href = triggeringLink.href + '&pop=1'; @@ -15,11 +17,12 @@ function showRelatedObjectLookupPopup(triggeringLink) { } function dismissRelatedLookupPopup(win, chosenId) { - var elem = document.getElementById(win.name); + var name = win.name.replace(/___/g, '.'); + var elem = document.getElementById(name); if (elem.className.indexOf('vRawIdAdminField') != -1 && elem.value) { elem.value += ',' + chosenId; } else { - document.getElementById(win.name).value = chosenId; + document.getElementById(name).value = chosenId; } win.close(); }