Copy link to clipboard
Copied
I am building an extension that allows our company to insert a CFINVOKE tag for a ColdFusion component with all of the proper arguments. One of the arguments for the component is an array of address information that looks like so in CF:
<cfset AddressArray = ArrayNew(2)>
<cfset AddressArray [1][1] = "XYZ Widget">
<cfset AddressArray [1][2] = "123 Somewhere St">
<cfset AddressArray [1][3] = "Nowherevilleton">
<cfset AddressArray [1][4] = "AA">
<cfset AddressArray [1][5] = "55555">
<cfset AddressArray [1][6] = "555-555-5555">
<cfset AddressArray [1][7] = "http ://goo.gl/rTyhf45">
This array can include multiple addresses. Too add a second address simply increment the first array index number from one to 2 and repeat the structure.
My extension needs to be able to create a multidimensional array in JS that is based off a form.
The primary form for the extension holds form fields for the other component arguments which consits of checkboxes and text fields and one textarea.
The textarea needs to be populated via a second form that appears when the user clicks on the "Add Address" button which should create a second dialog box with a simple form of text fields for the name, adddres, city, state, zip, phone, and url that are need by the CF array.
What I cannot figure out how to do is create this second dialog box. I have the following JS in place but it throws an error (openDialog() is not a function)
function addAddress() {
var retVals = {name: null, address: null, city: null, state: null, zip: null, phone: null, url: null};
window.openDialog("MapAddress.htm","", "all=no", retVals);
}
I tried window.open() but that just opens my browser. MapAddress.htm is the file that contains the second form.
All I need to know is how do I create a second dialog box from inside an extension, or is this even possible?
Copy link to clipboard
Copied
Hi,
You can open another form, but you have to pass parameters between windows (that is, your .htm files with your forms). Look at native extensions like C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS6\configuration\Commands\ServerObject-MastDetailPHP.htm for instance, and the dwscripts.callCommand() function in C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS4\configuration\Shared\Common\Scripts\dwscripts.js for an undocumented way of doing it.
But the simpliest way is to have two layers in your form and hide and display them according to your needs with some JavaScript like this:
var layer = dwscripts.findDOMObject('mylayername');
layer.style.visibility = "hidden";
or
layer.style.visibility = "visible";
Regards,
Xavier
MyDreamweaverExtensions.com