WebDevelopersNotes logo

home-icon Home / HTML / HTML form code – HTML Forms part 3

HTML form code – HTML Forms part 3

HTML form code - 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>

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.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sometimes i just need a break

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

A copy of Alexa's archive of web pages, totalling 2 TB in size, was given to the Library of Congress in 1998. [more...]