|
|
|
This month I will continue with the forms tutorial. It is pretty important that you have read the other two parts to this series before you read this.
RADIO BOXES Radio boxes are inserted using the <input> tag, by setting the "type" attribute to "radio": <input type="radio"> As always you must also set the "name" attribute. If you set the same name in a number of Radio boxes then they become a group of radio boxes and only one of them can be checked. Also the "value" attribute must be set for each box. The reason behind the value attribute was explained last month as follows: There is a very simple reason for this. Imagine you want someone's name. You simply supply an input field for them to type their name into. The name they type is returned to you as the value of that part of the form. (Don't worry about HOW it is returned to you yet). Well with a selection list, the visitor selects a particular option in the list and the value that is specified with the "value" attribute is returned to you. Maybe that's not so simple - read the paragraph again if you feel like it! If you want one of the boxes to be checked when the page loads then you simply add "checked" to it's code (as shown below). Remember that only one option from each group can be chosen. <form> If you want to see how the checkboxes look and work then visit http://www.usheen.com/suite101/form2.html This is a very simple example because every box is in the same group. Imagine this slightly more complicated scenario: You want to be able to choose between a Roll and a Sandwich and you also want to choose which filling you want. First of all we'll deal with the first part of the problem: Roll or Sandwich. <form> This is fairly simple. Next we have to add a choice of fillings. We just have to set a different "name" for the next options. I'll also add some "checked" attributes. <form> Go To Page: 1 2
The copyright of the article Forms - part 3 in HTML Lessons is owned by . Permission to republish Forms - part 3 in print or online must be granted by the author in writing.
|
|
|
|
|
|
|
|