Reference no: EM132088475
Validating form data: Make a copy of the order form from lab exercise 4 and name it l6p2.php.
Remove the JavaScript code to calculate the total price. If you used anything other than a plain text box for quantities, change the quantity inputs to type="text".
(The goal of this part of the assignment is for you to use regular expressions to validate text.)
Add JavaScript code to produce an error message and suppress submission of the form if any quantity field contains non-numeric data. (It's OK for a quantity to be empty, but if it's non-empty, it must have only numbers.) Add an action= attribute to your tag to submit the form.
Test that the form is submitted correctly when the quantities are numeric or empty, and that an error message is produced otherwise.
(Regular expressions are your friend. Anything that's not a digit is bad. What is the predefined class for non-digits?)
Add to your index page a link to your new order form. As with the previous assignment, the goal is to learn to validate with JavaScript.
The use of an input element with type "number" or anything similar will earn a zero on this part of the assignment. You must use JavaScript for the validation.