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.

The ID passed into the widget constructor identifies a specific HTML element. The constructor finds this element<br />

and looks inside the identified container for a corresponding textarea tag. If the ID passed to the constructor is the<br />

ID of the textarea tag (rather than a container tag), the constructor attaches validation triggers directly to the<br />

textarea tag. If there is no container tag, however, the widget cannot display error messages, and different<br />

validation states will only alter the appearance of the textarea tag element (for example, its background color).<br />

Note: Multiple textarea tags do not work inside the same HTML widget container. Each text field should be its own<br />

widget.<br />

CSS code for the Validation Text Area widget<br />

The <strong>Spry</strong>ValidationTextarea.css file contains the rules that style the Validation Text Area widget and its error<br />

messages. You can edit these rules to style the look and feel of the widget and error messages. The names of the rules<br />

in the CSS file correspond to the names of the classes specified in the widget’s HTML code.<br />

The following is the CSS code for the <strong>Spry</strong>ValidationTextarea.css file:<br />

/*Validation Textarea styling classes*/<br />

.textareaRequiredMsg, .textareaMinCharsMsg, .textareaMaxCharsMsg, .textareaValidMsg {<br />

display:none;<br />

}<br />

.textareaRequiredState .textareaRequiredMsg,<br />

.textareaMinCharsState .textareaMinCharsMsg,<br />

.textareaMaxCharsState .textareaMaxCharsMsg{<br />

display: inline;<br />

color: #CC3333;<br />

border: 1px solid #CC3333;<br />

}<br />

.textareaValidState textarea, textarea.textareaValidState {<br />

background-color:#B8F5B1;<br />

}<br />

textarea.textareaRequiredState, .textareaRequiredState textarea,<br />

textarea.textareaMinCharsState, .textareaMinCharsState textarea,<br />

textarea.textareaMaxCharsState, .textareaMaxCharsState textarea {<br />

background-color:#FF9F9F;<br />

}<br />

.textareaFocusState textarea, textarea.textareaFocusState {<br />

background-color:#FFFFCC;<br />

}<br />

.textareaFlashState textarea, textarea.textareaFlashState{<br />

color:red !important;<br />

}<br />

The <strong>Spry</strong>ValidationTextField.css file also contains extensive comments, explaining the code and the purpose for<br />

certain rules. For further information, see the comments in the file.<br />

SPRY<br />

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

Insert the Validation Text Area widget<br />

1 Locate the <strong>Spry</strong>ValidationTextarea.js file and add it to your web site. You can find the <strong>Spry</strong>ValidationTextarea.js<br />

file in the widgets/textareavalidation directory, located in the <strong>Spry</strong> directory that you downloaded from <strong>Adobe</strong> Labs.<br />

For more information, see “Prepare your files” on page 3.<br />

For example, create a folder called <strong>Spry</strong>Assets in the root folder of your web site, and upload the <strong>Spry</strong>ValidationTextarea.js<br />

file to it. The <strong>Spry</strong>ValidationTextarea.js file contains all of the information necessary for making the Text Area<br />

widget interactive.<br />

68

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

Saved successfully!

Ooh no, something went wrong!