04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

"zip_code", {format:"zip_custom", pattern:"AA\\\\00AA"});<br />

<br />

The preceding code results in a text field that accepts values such as UT\99CW, AB\87PP, GV\44RE, and so on, with<br />

the backslash appearing as an autocomplete character after the user types the first two capital letters.<br />

SPRY<br />

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

Customize state-related class names<br />

Whileyoucanreplaceerror-message-relatedclassnameswithclassnamesofyourownbychangingtherulesinthe<br />

CSS code and the class names in the HTML code, you cannot change or replace state-related class names, because<br />

the behaviors are hard-coded as part of the <strong>Spry</strong> framework. You can, however, override the default state-related class<br />

name with your own class name by specifying a new value in the third parameter of the widget constructor.<br />

❖ To change widget state-related class names, add one of the overriding options to the third parameter of the widget<br />

constructor, and specify your custom class name, as follows:<br />

<br />

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

{requiredClass:"required"});<br />

<br />

The following table provides a list of options you can use to override built-in state-related class names.<br />

Option Description<br />

requiredClass Overrides the "textfieldRequiredState" built-in value<br />

invalidFormatClass Overrides the "textfieldInvalidFormatState" built-in<br />

value<br />

validClass Overrides the "textfieldValidState" built-in value<br />

focusClass Overrides the "textfieldFocusState" built-in value<br />

invalidFormatClass Overrides the "textfieldInvalidFormatState" built-in<br />

value<br />

invalidRangeMinClass Overrides the "textfieldMinValueState" built-in value<br />

invalidRangeMaxClass Overrides the "textfieldMaxValueState" built-in value<br />

invalidCharsMinClass Overrides the "textfieldMinCharsState" built-in value<br />

invalidCharsMaxClass Overrides the "textfieldMaxCharsState" built-in value<br />

textfieldFlashTextClass Overrides the "textfieldFlashText" built-in value<br />

Working with the Validation Text Area widget<br />

Validation Text Area widget overview and structure<br />

A <strong>Spry</strong> Validation Text Area widget is a text area that displays valid or invalid states when the user enters a few<br />

sentences of text. If the text area is a required field and the user fails to enter any text, the widget returns a message<br />

stating that a value is required.<br />

The following example shows a Validation Text Area widget in various states.<br />

65

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

Saved successfully!

Ooh no, something went wrong!