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.

The default format is U.S. currency format: 1,000.00, but you can also specify the "dot_comma" format (1.000,00) in<br />

the third parameter, as follows:<br />

<br />

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

"currency", {format:"dot_comma"});<br />

<br />

In both cases, the separators for the 3-digit groups can be optional and the decimal part (i.e. the .00 in 1,000.00) is<br />

not required.<br />

The following table shows some other common options for the third parameter.<br />

Option Value<br />

format "comma_dot" (the default); "dot_comma"<br />

validateOn ["blur"]; ["change"]; or both together (["blur", "change"])<br />

isRequired true (the default); false<br />

useCharacterMasking false (the default); true<br />

minChars/maxChars Not applicable<br />

minValue/maxValue Numeric value with two decimal numbers allowed<br />

pattern Not applicable<br />

Validate real numbers and scientific notation<br />

❖ To set the text field to accept real numbers and scientific notation, add "real" as the value for the second<br />

parameter in the constructor, as follows:<br />

<br />

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

<br />

The text field validates a real number in scientific notation, for example 1.231e10.<br />

The following table shows some other common options for the third parameter.<br />

Option Value<br />

format Not applicable<br />

validateOn ["blur"]; ["change"]; or both together (["blur", "change"])<br />

isRequired true (the default); false<br />

useCharacterMasking false (the default); true<br />

minChars/maxChars Not applicable<br />

minValue/maxValue Numeric value with decimal numbers<br />

pattern Not applicable<br />

Validate an IP address<br />

❖ To set the text field to validate an IP address, add "ip" as the value for the second parameter in the constructor,<br />

as follows:<br />

SPRY<br />

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

58

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

Saved successfully!

Ooh no, something went wrong!