|
home—lects—exams—hws
breeze (snow day)
A common misunderstanding: “if I callsomeForm.submit() myself, then the browser will first look at the form's onSubmit tag and run that”. This is false! These two are layered the other way around: theonSubmit event causessubmit 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: lect06c-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
breeze (snow day)
©2011, Ian Barland, Radford University Last modified 2011.Oct.07 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |