HTML Form Element

3
141
HTML Form Element

HTML Form Element
The Form element consist of the following parts:-
a. Select
b. Option
c. Text Area
d. Input Option

1. SELECT:-
Inside HTML Form Element <Form> …. </Form> tag, any number of SELECT tags are permitted freely intermixed with other HTML elements and text. This tag allows a user to choose one of the set of alternatives. SELECT element is used for a query.

The SELECT element is a specialized for creating drop-down or scroll-able lists of menus only.

The basic structure of a HTML Form Element SELECT element is mentioned as under:

<SELECT Name =”select-menu>
<OPTION> View the product?
<OPTION> Call for help ?
<OPTION> Request a catalogue ?
<OPTION> Exit from this form ?
</SELECT>

HTML Form Element
The attributes to HTML Form Element SELECT tags are as follows :-
1. Name

This attribute is used to create a label for the SELECT data structure, like (“select menu”) in the above example. Notice that in the preceding arrangement, only one of the options is visible at a time and all are accessed through a drop-down menu.

Functionally, this is equivalent to the radio button possibility with the INPUT element of Type = “radio”, where one and only one, of a set of options can be made.

2. Size

It determines that how many options are visible at a time. The default value of size is 1. If size is 2 or more, the HTML Form Element SELECT will be represented as a scrolled list. To make more than one choice visible at a time, the SIZE attribute can be added as seen below:-

<SELECT Name =”select-menu” Size=”3″>
<OPTION> View the product?
<OPTION> Call for help ?
<OPTION> Request a catalogue ?
<OPTION> Exit from this form ?
</SELECT>

3. Multiple/Single
Because the default value of choosing option is SINGLE, therefore, user can choose only SINGLE.

In both of the above examples of SELECT statements, the user can make one and only one choice. By adding the HTML Form Element attribute MULTIPLE, the user will be able to choose more than one among several options.

<SELECT Name =”select-menu” Size=”3″ Multiple>
<OPTION> View the product?
<OPTION> Call for help ?
<OPTION> Request a catalogue ?
<OPTION> Exit from this form ?
</SELECT>

2. Option
This tag occurs only within the HTML Form Element SELECT element and is used to represent each choice of the SELECT. The attributes of OPTION are:-

a. Selected
It indicates that this option initially is selected.

b. Value
If present, this is the value returned by SELECT if this option is chosen, otherwise the value returned is that set by the HTML Form Element OPTION element.

c. Text Area
Text Area element is used to ask the user to enter several lines of text (as opposed to the single line with an INPUT element of Type= “text”).

A sample TEXTAREA tag is as follows:
<TEXTAREA Name=”comments” Rows=4 Cols=30>
</TEXTAREA>

This allows the user to enter any amount of text, with only 4 rows and 30 columns visible.
The HTML Form Element attributes associated with TEXTAREA is as follows:

Cols
The number of columns that will be displayed (the user can use the scroll bar to move through more columns if necessary).

Name
The logical name associated with the returned text.

Rows
The number of rows that will be displayed (note that the user can use more rows and scroll down to them).

For example:
<FORM action=”http://somesite.com/prog/text=read” method=”post”>
<TEXTAREA name=”thetext” rows=”20″ cols=”80″>
First line of initial text.
Second line of initial text.
</TEXTAREA>
</FORM>

4. INPUT

INPUT element is the basic way to get input from the user in a variety of situations. The key is that an INPUT element can define many types of graphical user interface features.

These are as follows:-
a. Pull down menus
b. radio buttons
c. text input boxes
d. text fields
e. check boxes.

HTML Form Element

A sample HTML Form Element INPUT tag that queries the user for a name (using “text” as the value of the attribute Type).

Type identifies the text value of the attribute that will be displayed as 40 characters.
The name attribute of the INPUT element designates the variable name that will be used in the data structure send to the query program. This name is used to identify the value of the user’s response from this INPUT element.

The input tag is very versatile and can be used to create many kinds of user interface features. The HTML Form Element input element has the following attributes:-
Align, Checked, Max length, Name, Size, Src, Text, Type, Value.

3 COMMENTS

  1. You are so cool! I don’t believe I have read through a single thing like that before. So nice to discover somebody with a few unique thoughts on this subject. Seriously.. thank you for starting this up. This web site is one thing that is needed on the internet, someone with a little originality.

LEAVE A REPLY

Please enter your comment!
Please enter your name here