Foothill Coin70: Assignment Set 4
461
Extended form validation. Self-imposed requirements: the form validation should be as generic and independent from the form that is being validatea as possible. This was done by expressing the validation requirements as parameters entered in the Html form itself. Therefore:
  • All the input fields that can be validated via regular expressions get a pattern parameter that contains the regular expression (as string, so it needs to be converted to a RegExp). This allows the code in the external javascript file to be generic, ie independent from the form.
  • Other fields (like Age) get both a pattern and a min_max field to establish the limits of the age.
  • The State field is transformed into a select box in this way: the state names were retrieved from the web and converted into an array by an off-line Perl script. The array was inserted in the javascript code. When the page is loaded, the select box is created dynamically.


[URL: ; Last updated: ]