<form> <span id=”mypassword”> Password: <input type=”password” name=”password”> <span class=”passwordRequiredMsg”>You must specify a password.</span> </span> <input type=”submit”> </form>
</body> </html> </code>
Since this is very similar to yesterday’s blog post, I won’t describe every line, but you can see where I have surrounded my password and then created a new instance of Spry.Widget.ValidationPassword. You can see an example of this here. Note as with the previous example, the error message within the span class is hidden on load. I can modify the look and feel of the error if I need to, but for now have left it with the default.
While this is nice and all - where things get interesting is the validation specifics we can apply to the widget. You can:
- Specify both a min and max number of characters for the password.
- Specify both a min and max number of letters for the password.
- Specify both a min and a max number of numbers for the password.
- Specify both a min and max number of upper case letters for the password.
- Specify both a min and max number of "special" characters for the password. (The docs don't detail what special is, but I assume they mean non-numeric, non-letter characters.
So here is one more example where the validaiton is more stringent: