CS 328 - Week 12 Lecture 1 - 2016-04-12
* another popular use of JavaScript:
to validate forms prior to submission
* PREVENT submission if they AREN'T up to
standards!
* for a form element,
you want to add an onsubmit attribute,
you want to set the onsubmit attribute to
a function that returns true or false;
when a form is submitted, then,
this function will be called;
IF it returns true,
the submission will be allowed to proceed;
IF it returns false,
the submission will NOT be allowed to proceed
(the form will NOT be submitted)
* see example: allFilled.js, three-value-form.php
(styled by three-value-form.js,
responded to by three-value-response.php)
^ note that three-value-response STILL
needs to make sure values OK -- what if
someone is coming to it NOT from
three-value-form.php??