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.

Option Value<br />

minChars/maxChars Not applicable<br />

minValue/maxValue Time value in the specified format<br />

pattern Not applicable<br />

Validate a credit card<br />

❖ To set the text field to accept a credit card format, add "credit_card" as the value for the second parameter in<br />

the constructor, as follows:<br />

<br />

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

"credit_card");<br />

<br />

The default is to validate all types of credit cards, but you can specify particular credit card formats to accept in the<br />

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

<br />

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

"credit_card", {format:"visa"});<br />

<br />

Thefollowingtableshowsafulllistofformattingoptions,aswellassomeothercommonoptionsandvalues,forthe<br />

third parameter.<br />

Option Value<br />

format No format (the default); "visa"; "mastercard"; "amex";<br />

"discover"; "dinersclub"<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 zip code<br />

❖ To set the text field to accept a zip code format, add "zip_code" as the value for the second parameter in the<br />

constructor, as follows:<br />

<br />

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

<br />

The default format is the U.S. 5-digit zip code format, but you can specify a number of other formats in the third<br />

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

<br />

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

"zip_code", {format:"zip_uk"});<br />

<br />

SPRY<br />

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

54

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

Saved successfully!

Ooh no, something went wrong!