04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Error message class Description<br />

.textfieldRequiredMsg Causes error message to display when the widget enters<br />

the required state<br />

.textfieldInvalidFormatMsg Causes error message to display when the widget enters<br />

the invalid state<br />

.textfieldMinValueMsg Causes error message to display when the widget enters<br />

the minimum value state<br />

.textfieldMaxValueMsg Causes error message to display when the widget enters<br />

the maximum value state<br />

.textfieldMinCharsMsg Causes error message to display when the widget enters<br />

the minimum number of characters state<br />

.textfieldMaxCharsMsg Causes error message to display when the widget enters<br />

the maximum number of characters state<br />

.textfieldValidMsg Causes error message to display when the widget enters<br />

the valid state<br />

Note: You cannot rename state-related class names because they are hard-coded as part of the <strong>Spry</strong> framework.<br />

Specify a validation type and format<br />

You can specify many different validation types, formats, and other options for the Validation Text Field widget. For<br />

example, you can specify a credit card validation type if the text field will receive credit card numbers.<br />

You specify validation types, formats, and other options as parameters in the widget constructor. The first parameter<br />

in the constructor is the widget container ID, followed by a second parameter (the validation-type parameter), and<br />

optionally, a third parameter. The third parameter is a JavaScript array of options that depends on the validation type<br />

set in the second parameter. Thus, you cannot set the third parameter without setting the second.<br />

Note: In cases where you want to set the third parameter, but no validation type is required, you can set the validation<br />

type to "none".<br />

The following code shows the generic syntax for a Text Field widget constructor with various parameters:<br />

<br />

var sprytextfield1= new <strong>Spry</strong>.Widget.ValidationTextField("WidgetContainerID",<br />

"ValidationType", {option1:"value1", option2:"value2", ..});<br />

<br />

Validation type options<br />

Most validation types cause the text field to expect a standard format. For example, if you apply the integer validation<br />

type to a text field, the widget won’t validate unless the user enters numbers in the text field. Some validation types,<br />

however, let you choose the kind of format your text field will accept.<br />

The following table lists the available validation types and their formats.<br />

SPRY<br />

<strong>User</strong> <strong>Guide</strong><br />

50

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!