User Guide

A simple data source example 303
{
retArray[0] = params.sourceName;
retArray[1] = params.bindingName;
}
}
return retArray;
}
function deleteDynamicSource(sourceName, bindingName)
{
var siteURL = dw.getSiteRoot();
if (siteURL.length)
{
//For localized object name
if (sourceName != "MyDatasource")
{
sourceName = "MyDatasource";
}
dwscripts.deleteListValueFromNote(siteURL, sourceName, bindingName);
}
}
Note: Save this file in the Configuration\DataSources\ColdFusion folder as MyDatasource.js
because that name is specified in “Creating the data source definition file” on page 300.
Creating the supporting command files for user input
The
addDynamicSource() function contains the command
dw.popupCommand("MyDatasrouce_Variable"), which opens a dialog box for the user to
input a specific variable name. However, you still need to create the actual dialog box for
MyDatasource Variable.
To provide a dialog box for the user, you must create a new set of command files: a command
definition file in HTML and a command implementation file in JavaScript (for more information
about command files, see “How commands work” on page 135).
The command definition file tells Dreamweaver the location of the supporting implementation
JavaScript files as well as the form for the dialog box that the user sees. Create an HTML file with
the following content (where MyDatasource_Variable.js is the implementation file that you will
create later):
<!DOCTYPE HTML SYSTEM "-//Macromedia//DWExtension layout-engine 5.0//dialog">
<html>
<head>
<title>MyDatasource Variable</title>
<script src="MyDatasource_Variable.js"></script>
<SCRIPT SRC="../Shared/MM/Scripts/CMN/displayHelp.js"></SCRIPT>
<SCRIPT SRC="../Shared/MM/Scripts/CMN/string.js"></SCRIPT>
<link href="../fields.css" rel="stylesheet" type="text/css">
</head>
<body>
<form>
<div ALIGN="center">
<table border="0" cellpadding="2" cellspacing="4">
<tr>
<td align="right" valign="baseline" nowrap>Name:</td>
<td valign="baseline" nowrap>