|
home—lects—exams—hws
D2L—breeze (snow day)
Due: 2012.Mar.30 (Fri) Apr.02 (Mon) 23:59.
We will further improve on hw03—Server side validation's .W.o.W. page by adding client-side validation, and making the form a sticky form.
Note:(A hw03-soln and your hw03 grades will be ready in the next couple of days — Mar.25)If the input field fails validation, dynamically modify the html page to insert (or remove/zero-out) an error message. (Recall lect06a-js—case study: refactoring javascript Use css to control the style of the error message.)
Include two check-boxes: one for “do not actually submit (even if the form info all validates)”, and one for “submit form even if validation fails”. (These aren't usual end-user options; we include them just so that we can still test our client-side validation and stickiness.)
Since these two options are mutually-exclusive, when a user selects one the other checkbox should be disabled234.
Make your page look neat and professional! You are encouraged to make your javascript code as similar as possible as the php-validation code, including wrapper functions to abstract away the differences.
1 True, if they came from the form and we had client-side error checking on, then theoretically there could be no errors server-side. However, we'll deal later with some validation that might only happen server-side, such as looking up login info in a database. In these cases, it's important that the form be sticky. ↩
2
You disable an input field by
setting its attribute
3 We saw how to set the attribute of a DOM node using javascript; that is similar to how we toggled the “display” attribute of paragraphs, in lect06a-js.html. ↩
4 Usually, radio-buttons are used for mutually exclusive options, though in this case you'd need three. However, for this hw you are required to use checkboxes that are dynamically disabled, to learn that skill. ↩
5 If you want to make your function even more general-purpose, you might pass in an additional value indicating whether the drop-down menu has an initial "please choose" or "--" neutral option, and perhaps whether or not the drop-down selection is required with any client-side check auto-coded, cool! ↩
6
If you want to make your function even more general-purpose,
you might have your function return an array of html-for-checkboxes,
so that the caller can insert those checkboxes
horizontally or in a table or with
7the function to show-source a file is one of the few exceptions ↩
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2012.Mar.28 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |