Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Eric Stauffer on Mar 17, 2009 08:09
open dhtmlx forum
aquiring object reference from dhtmlXWindows

I am using the codebase.zip file referenced at Jun 27, 2008 06:34 in :

http://dhtmlx.com/docs/products/kb/index.shtml?cat=15&page=3&q=3055&ssr=yes&s=not%20defined

I am attempting to populate a dropdown list via Javascript. My code is:

var dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(true);
dhxWins.setViewport(0, 0, 900, 5000);
dhxWins.vp.style.border = "#909090 1px solid";
dhxWins.setImagePath("/js/dhtmlxsuite/dhtmlxWindows/codebase/imgs/");
        
var w1 = dhxWins.createWindow("w1", 10, 10, 320, 240);
w1.setText("dhtmlxWindow");    
dhxWins.window('w1').attachURL("/client_specific/acme/addNewUserForm.php");

objWindowContent = window('w1')._frame.contentWindow;

objlist = objWindowContent.getElementById('medCenterLocation');

The last line fails with the error:

uncaught exception: [Exception... "Cannot convert WrappedNative to function" nsresult: "0x8057000d (NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN)"

Thanks in advance.
Answer posted by Alex (support) on Mar 18, 2009 04:12

Hello, 

The latest window version allows to use _frame property. So, it is better to download the new one. 

Moreover, please, be sure that the page inside iframe is already loaded. Possibly you need some timeout. 

If you load page from the same domain, you can use ajax loading. In this case, content is available after "onContentLoaded" event call:

dhxWins.attachEvent("onContentLoaded",function(win){

if(win==w1) objlist = document.getElementById('medCenterLocation');

})

The sample can be found in the windows package dhtmlxWindows/samples/init/attach_url_ajax.html