Spry

Specify when validation occurs

By default, the Validation Text Field widget validates when the user clicks the submit button. You can, however, set two other options: blur or change. The validateOn:["blur"] parameter causes the widget to validate whenever the user clicks outside the text field. The validateOn:["change"] parameter causes the widget to validate as the user changes text inside the text field.

 To specify when validation occurs, add a validateOn parameter to the constructor as follows:
<script type="text/javascript">
	var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
</script>

As a convenience, you can discard the brackets if your validateOn parameter contains a single value (for example, validateOn: "blur"). If the parameter contains both values, however (validateOn:["blur", "change"]), include brackets in the syntax.

Note: In the preceding example, the second parameter is set to "none", but it could easily be set to any of the available validation types (for example, "phone" or "credit_card"). See Specify a validation type and format.

Comments

Comments are no longer accepted for Spry 1.4. Spry 1.6 is the current version. To discuss Spry 1.4, please use the Adobe forum.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/en_US/Spry/1.4/WS5D92086E-6E0F-4c17-AFBC-9F8A29832E82.html