Engine for Web Applications

org.cote.js.xhtml.validator

Class Index

static org.cote.js.xhtml.validator.XHTMLValidator

version 1.9.18

Static instance of XHTMLValidatorImpl.

This class participates in the engine library.

org.cote.js.xhtml.validator.XHTMLValidatorImpl

version 1.9.18

A service for managing asynchronous and dependency-driven actions.

See Example Implementation for an example of implementating the script on a page. This class participates in the engine library.

Index

Example Index

Property Index

Method Index

Examples

Example Implementation

This is an example of using the XHTMLFormValidator and the external ValidationPatterns.xml file to validate a form field.

Example Code

<input type = "text" id = "oText" value = "my@ email.com" />
<script type = "text/javascript">
// The ValidationPatterns.xml file loads asynchronously
// Refer to Demonstration #5 for an example of using a task list
// to load the Application config, and have the validator automatically load the patterns file.
window.onload = init;
function init(){
org.cote.js.xhtml.validator.XHTMLValidator.load("ValidationPatterns.xml");
   // validate oText against the "email-address pattern
   var bValid = org.cote.js.xhtml.validator.XHTMLValidator.validateField(oT,"email-address");
   // obtain the error text for the "email-address" pattern.
   var sE = org.cote.js.xhtml.validator.XHTMLValidator.getValidationErrorText("email-address");
}
</script>

Properties

object_config

Object API structure for storing sub structures: object_config.pointers and object_config.status.

Syntax

object = object.object_config

object_id

Unique instance identifier.

Syntax

String = object.object_id

object_type

The type of this object.

Syntax

String = object.object_type

object_version

Version of the object class.

Syntax

String = object.object_version

ready_state

Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.

Syntax

int = object.ready_state

Methods

_parsePatterns

Parses the patterns from the specified XML document.

Syntax

void _parsePatterns( d )

Parameters

getIsWebSafe

Returns true if the field value validates against the web-safe pattern.

Syntax

b = getIsWebSafe( o )

Parameters

Returns

b as boolean: Bit indicating whether the specified field value validated against the

getObjectId

Returns the unique id of the object.

Syntax

i = getObjectId( )

Returns

i as String: The unique object instance id.

getObjectType

Returns the type of the object.

Syntax

t = getObjectType( )

Returns

t as String: The type of the object instance.

getObjectVersion

Returns the version of the object.

Syntax

v = getObjectVersion( )

Returns

v as String: The version of the object instance.

getPatternsFilePath

Returns the path to the patterns file.

Syntax

p = getPatternsFilePath( )

Returns

p as String: Path to the XML file containing the validation patterns.

getPatternsLoaded

Returns true if the patterns were loaded, false otherwise.

Syntax

b = getPatternsLoaded( )

Returns

b as boolean: Bit indicating whether the patterns were loaded.

getPointers

Returns the object_config.pointers sub structure.

Syntax

o = getPointers( )

Returns

o as object: The object_config.pointers substructure.

getReadyState

Returns the state of the object.

Syntax

s = getReadyState( )

Returns

s as int: The object ready state.

getStatus

Returns the object_config.status sub structure.

Syntax

o = getStatus( )

Returns

o as object: The object_config.status substructure.

getValidationErrorText

Returns the validation error text for the specified pattern id or based on the specified DOM Node.

Syntax

s = getValidationErrorText( o )

Parameters

Returns

s as String: Validation error text.

load

Loads the specified pattern file.

Syntax

void load( p )

Parameters

validateField

Returns true if the field value validates against the specified pattern, and returns true if no pattern is specified; otherwise returns false.

Syntax

b = validateField( o, i )

Parameters

Returns

b as boolean: Bit indicating whether the specified field value validated against the specified pattern.