Ticket #12713: fire_onchange_event_after_add_new_option.diff
File fire_onchange_event_after_add_new_option.diff, 1.5 KB (added by , 15 years ago) |
---|
-
django-fire_onchange_event_with_select/django/contrib/admin/media/js/admin/RelatedObjectLookups.js
13 13 14 14 // IE doesn't accept periods or dashes in the window name, but the element IDs 15 15 // we use to generate popup window names may contain them, therefore we map them 16 // to allowed characters in a reversible way so that we can locate the correct 16 // to allowed characters in a reversible way so that we can locate the correct 17 17 // element when the popup window is dismissed. 18 18 function id_to_windowname(text) { 19 19 text = text.replace(/\./g, '__dot__'); … … 55 55 function showAddAnotherPopup(triggeringLink) { 56 56 var name = triggeringLink.id.replace(/^add_/, ''); 57 57 name = id_to_windowname(name); 58 href = triggeringLink.href 58 href = triggeringLink.href; 59 59 if (href.indexOf('?') == -1) { 60 60 href += '?_popup=1'; 61 61 } else { … … 93 93 SelectBox.redisplay(toId); 94 94 } 95 95 win.close(); 96 if(elem.fireEvent) { 97 // for IE 98 elem.fireEvent('onchange'); 99 } 100 else { 101 // for gecko based and others 102 var evt = document.createEvent('HTMLEvents'); 103 evt.initEvent('change', true, true); 104 elem.dispatchEvent(evt); 105 } 96 106 }