Adobe 38040334 - Dreamweaver CS3 User Manual page 124

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

If none of these conditions apply, use the
Arguments
None.
Returns
Dreamweaver expects a string that contains an error message or an empty string. If it returns an empty string, the
Object dialog box closes when the user clicks OK. If it is not empty, Dreamweaver displays the error message and the
dialog box remains.
Enabler
canInsertObject()
Example
The following example uses the
function insertObject() {
var theForm = document.forms[0];
var nameVal = theForm.firstField.value;
var passwordVal = theForm.secondField.value;
var errMsg = "",
var isValid = true;
// ensure that field values are complete and valid
if (nameVal == "" || passwordVal == "") {
errMsg = "Complete all values or click Cancel."
} else if (nameVal.length < 4 || passwordVal.length < 6) {
errMsg = "Your name must be at least four characters, and your password at
least six";
}
if (!errMsg) {
// do some document manipulation here. Exercise left to the reader
}
return errMsg;
}
objectTag()
Description
The
and
objectTag()
insertObject()
function is used. For more information, see "insertObject()" on page 117.
objectTag()
This function inserts a string of code into the user's document. In Dreamweaver MX, returning an empty string, or
a
value (also known as "
null
Note: The assumption is that edits have been made manually before the
is not equivalent to clicking Cancel.
In Dreamweaver 4, if the focus is in Code view and the selection is a range (meaning that it is not an insertion point),
the range is replaced by the string that the
function returns an empty string or returns nothing. The
objectTag()
string or a
value because edits to the document have already been made manually. Otherwise, double quotation
null
marks (" ") often delete the edit by replacing the selection.
objectTag()
function because it needs to validate input before inserting code:
insertObject()
functions are mutually exclusive: If both are defined in a document, the
;"), is a signal to Dreamweaver to do nothing.
return
objectTag()
function.
statement, so doing nothing in this case
return
function returns. This is the value
objectTag()
DREAMWEAVER CS3
Extending Dreamweaver
, even if the
true
function returns an empty
118

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents