RU beehive logo ITEC dept promo banner
ITEC 325
2017fall
ibarland

homelectshws
D2Lbreeze (snow day)

client-side-validation
Client side validation

Due: 2017.Nov.06 (Mon) 11:00 Submit on D2L, and as usual have your a link to your form available at https://php.radford.edu/~yourUserId/itec325/hw06/index.php. (No hardcopy needed.)

We will further improve on server-side-validation/’s Okaymon page by adding client-side validation. Make a copy of your directory from hw051, named hw06/. (cp -pR hw05/ hw06 will Recursively copy directories, preserving timestamps.)

  1. (15pts) Using html attributes like maxlength etc., validate all input fields using the same criteria as on the previous homework.

    Be sure to use your named-constants file, for the field-lengths. (1/3 of the points are for that.)

  2. (5pts) As a javascript warm-up: Make your submit-button be greyed-out (set its disabled attribute), if the Intellectual Property checkbox is not selected.
    You don't need to have any other inputs affect the submit-button this way.
  3. (10pts) We're going to add one further validation requirement: the Okaymon's weight must be less than 10,000 lbs. That is, we want to give an error if the user enters a weight of 5000kg ≈ 5000kg·2.2lbs/kg = 11,000lbs.

    Write a separate javascript function which does this: if the field is too big, it inserts the message-text into a nearby span whose id is weight-err.
    (You may write reportError yourself, or use the version in the notes (with citation of course).)

    Make sure that onsubmit of the form, you also call call the validation function for the weight; if it is too large, then the form doesn't get submitted (and the error-message is being shown).

  4. Optional/extra-credit: For text inputs, immediately upon being entered, your javascript can trim and collapse whitespace as in hw02. (And for even a bit more extra-credit, if this results in changing what the user typed, you can display a message politely informing the user that their information was changed/normalized. You should be able to re-use code which inserted error-messages, perhaps refactoring a bit to support error- and non-error messages.)

Other requirements

These apply to all homeworks for this class:

1You can also use the hw05-soln (posted); just cite your source as usual.      
2the function to show-source a file is one of the few exceptions      

homelectshws
D2Lbreeze (snow day)


©2017, Ian Barland, Radford University
Last modified 2017.Oct.30 (Mon)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.