Site Navigation

Monday, October 19, 2009

bug 234 - showModalDialog Array returnValue now fails

Issue: #234
Affects: IE6, IE7, IE8

We haven't discovered if this bug is exclusive to VBScript or if it affects JavaScript too (but feel free to update us in the comments if you know).

If you downloaded the latest IE Cumulative Security Update for October 2009 security patch, which "fixed" Microsoft Knowledge Base Article 974455 then you may have noticed that the showModalDialog documentation indicates that the window.returnValue accepts an Array.

However after updating KB974455, there was an undocumented change that now Array return values are no longer allowed.

So what can you do if you depend on this non-standard dialog? Well, the workaround is ugly but there hasn't been confirmation from Microsoft that this bug was introduced - nor that a fix is on the way.



Known Workarounds: One. Use something other than an Array and handle the return value accordingly.

Example Workaround Code:

On the Popup window:

<script type="text/vbscript">
//was
window.returnValue = arrayValue;

//now use
arrString = Join(arrayValue, ";");
window.returnValue = arrString;
</script>



On the Calling window (e.g. Opener):

<script type="text/vbscript">
//was
retArray = window.showModalDialog( ... );

//now use
tempRetArray = window.showModalDialog( ... );
retArray = Split(tempRetArray, ";");
</script>



Related Issues: None.



Bug/Site Feedback |
Submit a bug

1 comment:

skeevs said...

Microsoft has published a KB article regarding this issue caused by KB974455 : http://support.microsoft.com/kb/976749/en-us

For the last workaround :Creating Array in Javascript only works if the functions are within the same page, as shown in the sample code.

If you attempt to return the Javascript instantiated array to window.showModalDialog() and the calling code is VBScript, the array will be invalid/lost somehow