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.

SPRY<br />

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

<br />

<br />

<br />

<br />

Maximum number of characters exceeded<br />

<br />

<br />

<br />

var sprytextarea1 = new <strong>Spry</strong>.Widget.ValidationTextarea("sprytextarea1" {maxChars:100});<br />

<br />

Leave the new tag empty. <strong>Spry</strong> provides the content of the tag later as the user types in text.<br />

Note: The counter tag must appear within the HTML container tag for the widget.<br />

2 Add the counterType option and a value to the widget constructor, as follows:<br />

<br />

<br />

<br />

<br />

Maximum number of characters exceeded<br />

<br />

<br />

<br />

var sprytextarea1 = new <strong>Spry</strong>.Widget.ValidationTextarea("sprytextarea1" {maxChars:100,<br />

counterType:"chars_remaining"});<br />

<br />

The counterType option defines the type of counter to use and can take two values: "chars_count", or<br />

"chars_remaining".The"chars_count" value results in a counter that counts the number of characters typed in<br />

the text area. The "chars_remaining" value results in a counter that displays the number of characters remaining<br />

before the maximum number of characters is reached. The second option must be used in conjunction with the<br />

maxChars option, as in the preceding example. For more information, see “Specify a minimum and maximum<br />

number of characters” on page 71.<br />

3 Add the counterId option to the widget constructor, and set its value equal to the unique idea you assigned to<br />

the counter span tag, as follows:<br />

<br />

<br />

<br />

<br />

Maximum number of characters exceeded<br />

<br />

<br />

<br />

var sprytextarea1 = new <strong>Spry</strong>.Widget.ValidationTextarea("sprytextarea1" {maxChars:100,<br />

counterType:"chars_remaining", counterId:"my_counter_span"});<br />

<br />

72

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

Saved successfully!

Ooh no, something went wrong!