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 sprytextfield1= new <strong>Spry</strong>.Widget.ValidationTextField("sprytextfield1", "ip");<br />

<br />

The default accepted IP address format is IPv4, but you can set other IP address formats in the third parameter by<br />

using the format option, as in the following example:<br />

<br />

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

{format:"ipv6"});<br />

<br />

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

Option Value<br />

format "ipv4" (the default); "ipv6"; "ipv4_ipv6"<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 Not applicable<br />

pattern Not applicable<br />

Validate a URL<br />

❖ To set the text field to accept only URL values, add "url" asthevalueforthesecondparameterintheconstructor,<br />

as follows:<br />

<br />

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

<br />

The URL validation type accepts HTTP, HTTPS, and FTP URL values.<br />

The following table shows 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 Not applicable<br />

minChars/maxChars Positive integer value<br />

minValue/maxValue Not applicable<br />

pattern Not applicable<br />

Validate a custom format<br />

❖ To set the text field to accept any kind of customized format, specify "custom" as the value for the second<br />

parameter, and adding the pattern option in the third parameter, as follows:<br />

SPRY<br />

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

59

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

Saved successfully!

Ooh no, something went wrong!