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.

B<br />

C<br />

D<br />

A. Characters remaining counter B. Text Area widget in focus, maximum number of characters state C. Text Area widget in focus, valid state<br />

D. Text Area widget, required state E. Characters typed counter<br />

The Validation Text Area widget includes a number of states (for example, valid, invalid, required value, and so on).<br />

YoucanalterthepropertiesofthesestatesusingthePropertyinspector,dependingonthedesiredvalidationresults.<br />

A Validation Text Area widget can validate at various points—for example, when the user clicks outside the widget,<br />

as the user types, or when the user tries to submit the form.<br />

Initial state When the page loads in the browser, or when the user resets the form.<br />

Focus state When the user places the insertion point in the widget.<br />

Valid state When the user enters information correctly, and the form can be submitted.<br />

Required state When the user fails to enter any text.<br />

Minimum Number Of Characters state When the user enters fewer than the minimum number of characters<br />

required in the text area.<br />

Maximum Number Of Characters state When the user enters greater than the maximum number of characters<br />

allowed in the text area.<br />

Whenever a Validation Text Area widget enters one of these states through user interaction, the <strong>Spry</strong> framework<br />

logic applies a specific CSS class to the HTML container for the widget at run time. For example, if a user tries to<br />

submit a form, but did not enter text in the text area, <strong>Spry</strong> applies a class to the widget that causes it to display the<br />

error message, “A value is required.” The rules that control the style and display states of error messages exist in the<br />

<strong>Spry</strong>ValidationTextarea.css file that accompanies the widget.<br />

The default HTML code for the Validation Text Area widget, usually inside a form, is made up of a container span<br />

tag that surrounds the textarea tag of the text area. The HTML code for the Validation Text Area widget also<br />

includes script tags in the head of the document and after the widget’s HTML code.<br />

TheHTMLcodefortheValidationTextAreawidgetalsoincludesscript tags in the head of the document and after<br />

the widget’s HTML code. The script tag in the head of the document defines all of the JavaScript functions related<br />

to the Text Area widget. The script tag after the widget code creates a JavaScript object that makes the text area<br />

interactive.<br />

Following is the HTML code for a Validation Text Area widget:<br />

A<br />

E<br />

SPRY<br />

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

66

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

Saved successfully!

Ooh no, something went wrong!