Passing Variables to Window

I want to use dhtmlxWindow to pop up a information form that will result in adding a record to a database table. To make it easier for the user, I would like to pre-populate as much of the popup form as possible. What is the best way to do this? I am currently building the form as a separate php file that I then call using attachURL.

I am trying to use Session Variables (haven’t found out if it will work yet), but either way I would be interested in knowing if there is a better way.

Thank you.

You may also use our dhtmlxForm: … indow.html

Form structure and data can be loaded by Ajax. Here are samples: … m_xml.html … _save.html

I don’t think those will work. I am calling up the Window on an onClick javascript function. That function is passed the parameters I want to show up in the Window. How can I do this?

Here is the onClick function: function createNewRecord(username, fullname, email){ dhxWins = new dhtmlXWindows(); dhxWins.enableAutoViewport(false); dhxWins.attachViewportTo("winBody"); dhxWins.setImagePath("/dhtmlx/dhtmlxWindows/codebase/imgs/"); w1 = dhxWins.createWindow("w1", 350, 200, 520, 432); w1.setText("New Record"); w1.denyResize(true); w1.button("minmax1").hide(); w1.button("minmax2").hide(); w1.button("park").hide(); w1.setModal(true); w1.attachURL("NewRecordForm.php",true); w1.bringToTop(); w1.centerOnScreen(); var pos = w1.getPosition(); var height = document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight; var scrollPosition=(document.body.scrollTop?document.body.scrollTop:(document.documentElement.scrollTop?document.documentElement.scrollTop:window.pageYOffset))||0; w1.setPosition(pos[0],height/2-210+scrollPosition); }


attachURL(url,true) loads data via Ajax. The content is added as innerHTML of the window. So, you should consider this.

w1.attachURL(url) or w1.attachURL(url,false) loads page into an iframe.