Prev | Current Page 757 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Of course,
adding a nonstandard attribute will break the HTML validation and for the purists this will be simply
inadmissible. If you cannot live with this solution, you can always move the validation rule binding to
the behavior layer, but this will probably violate the separation of concern paradigm because you are
moving contents to the wrong place.
To limit the syntax invalidation to the bare minimum, just one new attribute is added: validation . The
validation attribute defines the rules to apply to the current control and their optional parameters.
More than one rule can be applied to each control separated with one whitespace character. The example
shows an input control for a value that is mandatory and that only accepts Internet e - mail addresses as
values.
< input type=???text??? name=???email??? validation=???required email??? / >
The attribute expresses its purposes in a very clean and easy way. An input control for a password that
must be between 6 and 20 characters long could be defined in this way.


Pages:
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769