Page 153 - DCAP202_Fundamentals of Web Programming
P. 153
Fundamentals of Web Programming
Notes 13. The ................................. specify the output value of input element in html page, when it is
clicked.
12.7 Select and Option Element
HTML select fields provide essentially the same functionality as HTML Checkbox Fields. They
allow the user to select one or more values from a predetermined series of options.
Notes Incorporating a select field into a web page is done using the <select> tag.
List values are then added to the field using the <option> tag, similar to how list items <li> are
added to ordered list elements (<ol>).
Example:
<select name=”selectionField”>
<option value=”CA” >California — CA </option>
<option value=”CO” >Colorado — CO</option>
<option value=”CN” >Connecticut — CN</option>
</select>
12.7.1 HTML Drop Down Lists
Drop-down menus are probably the most flexible objects you can add to your forms.
Depending on your settings, drop-down menus can serve the same purpose as radio buttons
(one selection only) or check boxes (multiple selections allowed).
The advantage of a drop-down menu, compared to radio buttons or check boxes, is that it takes
up less space.
But that is also a disadvantage, because people can’t see all options in the menu right away.
There is a workaround for this - with the size setting, you can customize the menu so it shows
more than just one option at a time, but when you do that – you also lose the advantage of taking
up less space.
Sometimes you may want to replace text fields with drop-down menus. This might be because
selecting from a menu is easier than typing. But it could also be because the script that handles
the form can’t interpret just any text entry.
Example: You will often be asked to choose your state from a drop-down menu. This
might be because picking it from the menu is easier than typing the name of the state.
Along the same line, you may often asked to enter the 2 letter initials of your state from a drop-
down menu as well.
This could prevent confusion for the script that handles the form input. If, say, the script was
programmed to only accept capital letters, then a drop-down menu would secure that no invalid
entries were made.
146 LOVELY PROFESSIONAL UNIVERSITY