HTML Forms part 3


SELECT>... </SELECT> form element

This HTML form element lets you develop a drop down scrolling list or menu. The list can allow for single as well as multiple selections.
The individual items of the list are placed with the help of another tag, <OPTION> (described below).
The attributes taken are:
  • NAME: defines a name for this element.
  • SIZE: if the size is '1', the list is displayed as a dropdown menu else as a scrolling list.
  • MULTIPLE: allows for multiple selection.
Here is how you create a four-item drop down selection list.
Which system do you use? 
<SELECT NAME="platform" SIZE="1">
<OPTION VALUE="win">Windows
<OPTION VALUE="mac">Macintosh
<OPTION VALUE="unix">Unix
<OPTION VALUE="oth">Other
</SELECT>
Which system do you use?


<OPTION> </OPTION>

The <OPTION> tag defines an item of the selection list described above. Its end tag is not required. It takes two attributes:
  • VALUE: Gives a value to the item that is sent to the server along with the selection list name.
  • SELECTED: Selects an item when the form is displayed.
Which system do you use? 
<SELECT NAME="platform" SIZE="1">
<OPTION VALUE="win">Windows
<OPTION VALUE="mac">Macintosh
<OPTION VALUE="unix" SELECTED>Unix
<OPTION VALUE="oth">Other
</SELECT>
Which system do you use?


HTML form TEXTAREA elements

This creates a multi-line text box. Its attributes are:
  • NAME: Defines a name for this element.
  • COLS: Specifies the number of character columns. Thus, a value of 20 means that the text box is twenty character in width.
  • ROWS: Determines the height of text box in terms of character rows.
  • WRAP: Sets word wrapping inside the text box and can take off, virtual or physical as value. 'Off' turns word wrapping off. Through 'virtual', word wrapping is turned on but the line endings are not transmitted to the server. 'Physical' displays and sends the line endings to the server.
To define a value for the TEXTAREA, include the text between the start and end tags.
<TEXTAREA NAME="query" COLS="20" ROWS="5">
Please type your query here.
</TEXTAREA>



<BUTTON>...</BUTTON>

This element is specific to Internet Explorer and ignored by Netscape.
It creates a button that is quite similar to ones made by <INPUT TYPE="BUTTON">. It takes the following attributes:
  • NAME: Sets a name for the button.
  • TYPE: Can take either SUBMIT, RESET or BUTTON as value.
  • VALUE: Defines the value that is sent to the server along with the button name.
<BUTTON NAME="somebut" TYPE="BUTTON" VALUE="justabut">
Just for Kicks</BUTTON>
  (Netscape users will not see the button)
Note: The text that is placed between the closing and ending tags is displayed on the button.
What do you do now?
As mentioned previously, forms are pretty useless if you don't know client-side or server side scripting. In order to gain full advantage of forms, you should learn a client-side and a server-side language.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

0 Response to "HTML Forms part 3"

Post a Comment