User Guide
56 Chapter 3: User Interfaces for Extensions
As with normal (noneditable) select lists, editable select lists have a selectedIndex property (see
“Objects, properties, and methods of the Dreamweaver DOM” on page 68). This property
returns -1 if the text box is selected.
To read the value of an active editable text box into an extension, read the value of the
editText
property. The
editText property returns the string that the user entered into the editable text
box, the value of the
editText attribute, or an empty string if no text has been entered and no
value has been specified for
editText.
Dreamweaver adds the following custom attributes for the
select tag to control editable
pop-up lists:
Note: Editable select lists are available in Dreamweaver.
The following example creates a command that contains an editable select list using common
JavaScript functions:
<html>
<head>
<title>Editable Dropdown Test</title>
<script language="javascript">
function getAlert()
{
var i=document.myForm.mySelect.selectedIndex;
if (i>=0){
alert ("selectedIndex: " + i);
alert("selected text " + document.myForm.mySelect.options[i].text);
}
else{
var i=document.myForm.mySelect_no.selectedIndex;
if (i>=0){
alert ("selectedIndex: " + i);
alert("selected text " +
document.myForm.mySelect_no.options[i].text);
}
else
alert("nothing is selected");
}
}
function commandButtons()
{
return new Array("OK", "getAlert()", "Cancel", "window.close()");
}
</script>
</head>
<body>
<div name="test">
<form name="myForm">
<table>
<tr>
<td>Editable DropDown with default text:</td>
Attribute name Description Accepted Values
editable
Declares that the pop-up list has an editable
text area
A Boolean value of true or false
editText
Holds or sets text within the editable text area A string of any value