Spry Email Validation

First you have to include the js and css files for the spry framework. In this example taken from the spry demos we have two files. Both are designed for text fields.

The actual form field will be wrapped in a div or span tag with an id. Any messaging then gets its own span class within the div.

Below the form on the page, the following scripting is added. This will validate that there is a correct email typed into the text field. Validating on change checks the field on each character entered. For emails it would be better to validate on blur. The user will not get constant reminders as they type.

Notice that there's no Regex on the screen. I didn't need any, the Spry framework took care of it.

, ,

  1. #1 by eric stevens at April 1st, 2008

    I wonder what regex they use under the hood there.

(will not be published)
  1. No trackbacks yet.