|
home—lects—exams—hws
D2L—breeze (snow day)
A common misunderstanding: “if I callsomeForm.submit() myself, then the browser will first look at the form's onSubmit attribute and run that”. This is false! These two are layered the other way around: the onsubmit event causes the underlying submit method to be called, not vice-versa.
- sticky form: (a) When you make the form, include 'value=...' in the tags appropriately. (b) But to do this, the page that *makes* the form has to be the same as the page that *recives* the form! (c) Imagine a big if-statement: if (this-form-was-submitted) { ...validate and print server-side error message... } if (form-was-submitted && data-is-valid) { ...handle the accepted form stuff... } else { ...print the form... echo "<input type='text' name="lastName" value=??? maxlength=??? /> } (c2) example: lect07b-sticky-form.php (d) <input type="hidden" name="i-came-from-the-form" value="true" /> (e) You can include files: require include require_once include_once
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2012.Mar.29 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |