< input type=???password??? name=???password??? validation=???required range(min:6,max:20)??? / >
The named parameters help a lot to identify the purpose of each argument.
To keep the implementation simple, the validation rule is working reliably only on input elements of
type text and password ; some work may be needed to make it work on other elements.
What follows is a full example of a form with some rules applied. Figure 14 - 3 shows the example
rendered by the Mozilla Firefox browser (the CSS style sheet content is linked in the example but is not
provided here for brevity).
406
Part II: Server Side, JavaScript, and Flash: Oh My!
< html >
< head >
< title > Form Validation < /title >
< link rel=???stylesheet??? type=???text/css??? href=???main.css??? / >
< /head >
< body >
< form action=???#??? method=???post??? >
< fieldset >
< legend > Personal Information < /legend >
< div >
< label for=???name??? > Full Name < /label >
< input type=???text??? name=???name??? id=???name??? validation=???required??? / >
< /div >
< div >
< label for=???age??? > Age < /label >
< input type=???text??? name=???age??? id=???age??? validation=???int(min:13,max:150)??? / >
< /div >
< /fieldset >
< fieldset >
< legend > Login Information < /legend >
< div >
< label for=???email??? > Email < /label >
< input type=???text??? name=???email??? validation=???required email??? / >
< /div >
< div >
< label for=???username??? > User Name < /label >
< input type=???text??? name=???username???
validation=???required loweralphanum range(min:3,max:12)??? / >
< /div >
< div >
< label for=???password??? > Password < /label >
< input type=???password??? name=???password???
validation=???required range(min:6,max:20)??? / >
< /div >
< div >
< label for=???confirmpassword??? > Confirm Password < /label >
< input type=???password??? name=???confirmpassword???
validation=???compare(field:password)??? / >
< /div >
< /fieldset >
< fieldset class=???submission??? >
< input type=???reset??? name=???reset??? value=???Reset??? / >
< input type=???submit??? name=???submit??? value=???Submit??? / >
< /fieldset >
< /form >
< script type=???text/javascript??? src=???main.
Pages:
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770