Thanks for the reply Robin but neither suggestion worked. What really confused me about this was that I was referencing the right place as the select box was cleared when I set the length to 0.
I have since done it differently - I construct a JavaScript array in the popup and pass this to a function in the opener. This works fine but I would still like to know why the other method didn't work. Thanks for the reply. Giles Roadnight http://giles.roadnight.name -----Original Message----- From: Robin Griffiths [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 16:09 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] OT: Javascript Help Couple of things to try... 1. Use this constructor for the new options... opener.#attributes.formname#.previewMenu.options[#(i-1)#] = new Option('Test','Test',0,0) 2. Are you sure 'opener' is referencing the right point in the DOM - off the top of my head opener is a window object, whereas forms live in a document object, or in other words, try opener.document.form etc. Use alert('string') to make sure these objects exist - i.e alert(opener.document) should result in a popup with [object] rather than an error. HTH -----Original Message----- From: Giles Roadnight [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 11:54 To: [EMAIL PROTECTED] Subject: [ cf-dev ] OT: Javascript Help Hi I have a form that when submitted opens a popup that uploads an image. The directory where the image is stored is the retrieved with cfdirectory and a select object in the opener populated with the new list of files. At least that is what is supposed to happen. I can't get the select in the opener to display the new list. My CF code in the popup is this: <cfdirectory directory="#attributes.sourceFolder#" name="directoryListing" action="list" filter="*.jpg|*.gif"> <Cfoutput> <script language="JavaScript" type="text/javascript"> <!-- opener.#attributes.formname#.previewMenu.options.length = 0; <cfloop index="i" from="1" to="#directoryListing.recordcount#"> <!---opener.#attributes.formname#.previewMenu.options[#(i-1)#] = new Option("#directoryListing.name[i]#","#request.imageMagick.width#:#reques t.imageMagick.height#")---> opener.#attributes.formname#.previewMenu.options[#(i-1)#] = new Option('Test') </cfloop> window.close(); //--> </script> </Cfoutput> The source that appears in the popup is: <script language="JavaScript" type="text/javascript"> <!-- opener.frmDynamicPage.previewMenu.options.length = 0; opener.frmDynamicPage.previewMenu.options[0] = new Option('Test') opener.frmDynamicPage.previewMenu.options[1] = new Option('Test') opener.frmDynamicPage.previewMenu.options[2] = new Option('Test') opener.frmDynamicPage.previewMenu.options[3] = new Option('Test') window.close(); //--> </script> I get a javascript error of "The server threw an exception". IE usually then crashes and closes the popup (the window.close() doesn't work. The select box is however cleared so the first line setting the length to 0 works. In the opener I have this button: <input type="button" value="test" onClick="this.form.previewMenu.options[this.form.previewMenu.options.len gth] = new Option('Test')"> that works fine. I'm lost - hope someone can help. Thanks Giles Roadnight http://giles.roadnight.name -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
