beautypg.com

Dom.source.getvalidationerrorsforoffset() – Adobe Dreamweaver API Reference CS5 User Manual

Page 482

background image

477

DREAMWEAVER API REFERENCE

Code

Last updated 8/27/2013

Description
Returns the text string in the source between the designated offsets.

Arguments
startOffset, endOffset

The startOffset argument is an integer that represents the offset from the beginning of the document.

The endOffset argument is an integer that represents the end of the document.

Returns
A string that represents the text in the source code between the offsets start and end.

dom.source.getValidationErrorsForOffset()

Availability
Dreamweaver MX 2004.

Description
Returns a list of validation errors at the specified offset, or it searches from the offset for the next error. If none are
found the function, returns

null

.

Arguments
offset, {searchDirection}

The offset argument is a number that specifies the offset in the code for which the function will return any errors.

The searchDirection argument, which is optional, is a string that specifies "

empty

", "

forward"

or "

back".

If

specified, the function searches forward or back from the given offset to the next characters with errors and returns
them. If not specified, the function simply checks for errors at the given offset.

Returns
An array of objects or the value

null

. Each object in the array has the following properties:

The

message

object is a string that contains the error message.

The

floaterName

object is a string that contains the name of the results window. You can pass this value to the

showResults()

or

setFloaterVisibility()

functions.

The

floaterIndex

object is an index of items in the floater results list.

The

start

object is the opening index of underlined code.

The

end

object is the closing index of underlined code.

Note: The returned floater indexes should not be stored because they can change frequently, such as when documents are
opened or closed.

Example
The following example calls

getValidationErrorsForOffset()

to check for any errors at the offset of the current

selection. If the function returns an error, the code calls the

alert()

function to display the error message to the user.