FAQ : Frequently Asked Questions | ||
|
13. |
Q:
Is it possible to have a form with multiple buttons?
A: In plain HTML you can have more than one submit single button. See the following example (you may push the buttons, in order to display the request string in the Location line of your browser. However, note that the request will be actually submitted to the server, but in this example there is no program at the server servicing the request):
An alternate solution is to define
type="button" inputs instead of
type="submit" inputs.
It works in the following way:
One advantage of using inputs type="button" and JavaScript is that you may validate input fields (example: numeric fieds) through Javascript and warn the user right away, without having that done from the server CGI program. Should you like to know more about JavaScript, please visit our JavaScript Tutorial |