-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrb_formsubmit.js
More file actions
30 lines (21 loc) · 857 Bytes
/
rb_formsubmit.js
File metadata and controls
30 lines (21 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
New Perspectives on HTML and CSS, 7th Edition
Tutorial 7
Tutorial Case
Filename: rb_formsubmit.js
Purpose: The purpose of this program is to simply report on a
successful completition of a valid Web form.
When the form is submitted, the onsubmit event handler
verifies that the form data is complete and valid.
An alert box is displayed notifying the user.
The event function returns a value of false so that the
student does not have to continually retype test values
in the survey form.
*/
window.onload = setForm;
function setForm() {
document.forms[0].onsubmit = function() {
if (this.checkValidity()) alert("No invalid data detected. Will retain data for further testing.");
return false;
}
}