Beginning HTML5 and CSS3 For Dummies
Book image
Explore Book Buy On Amazon

Submit and Reset buttons help the user tell the browser what to do with a form on your website. You can use HTML to create buttons to either submit or reset your form, using the element with the following type and value attributes:

  • Submit: Visitors have to tell a browser when they’re done with a form and want to send the contents. You create a button to submit the form to you by using the following markup:

    You don’t use the name attribute for the Submit and Reset buttons. Instead, you use the value attribute to specify how the browser labels the buttons for display.

  • Reset: Visitors need to clear the form if they want to start all over again or decide not to fill it out. You create a button to reset (clear) the form by using the following markup:

You can set the value to anything you want to appear on the button. In our example, we set ours to Clear. Of course, you can use something that’s more appropriate to your website if you’d like.

This listing shows an example of markup to create Submit and Reset buttons named Send and Clear, respectively. It’s the listing for a complete multipart form.


    Basic Form Markup
    
    


  

Multi-Part Form


Name and Password

First Name:

Last Name:

Password:

Favorite Foods

What are some of your favorite foods?

Pizza

Ice Cream

Green Eggs and Ham

Gender Information

What is your gender?

Male

Female


This figure shows how a browser renders these buttons in a form.

image0.jpg

About This Article

This article is from the book:

About the book authors:

Ed Tittel is a 30-year veteran of the technology industry with more than 140 computing books to his credit, including the bestselling HTML For Dummies.

Chris Minnick runs Minnick Web Services. He teaches, speaks, and consults on web-related topics and has contributed to numerous books, including WebKit For Dummies.

This article can be found in the category: