Quiz
Test your knowledge of JavaScript's form objects by answering the following questions.
Questions
Which of these attributes of a <form> tag determines where the data will be sent?
ACTION
METHOD
NAME
Where do you place the onSubmit event handler to validate a form?
In the <body> tag.
In the <form> tag.
In the <input> tag for the Submit button.
What can JavaScript do with forms that a CGI script can't?
Cause all sorts of problems.
Give the user instant feedback about errors.
Submit the data to a server.
Answers
a. The ACTION attribute determines where the data is sent.
b. You place the onSubmit event handler in the <form> tag.
b. JavaScript can validate a form and let the user know about errors immediately, without waiting for a response from a server. (If you use server-side JavaScript, you can also submit the data to the server, but that's another story.)