Page 134 - iPlus_Ver_2.0_class_7
P. 134

Generally, a form is a collection of different types of fields to take the input from the user on
                  a web page. It replaces the paper-based forms used earlier. Nowadays, we notice that most
                  schools, universities, and other commercial organisations use online forms to submit or accept
                  information. Different types of fields, such as text boxes, checkboxes, radio buttons, drop-down
                  menus, and passwords, are used to accept different types of information.

                  HTML provides two main tags, which are <FORM> and <INPUT> to handle the forms on the web
                  page. Let us learn about these in detail.
                  The <FORM> Tag

                  The <FORM> tag is used to create the form boundary on the web page. It is a container tag. All
                  the other form related tags, such as <INPUT>, <SELECT> and <TEXTAREA> are used inside the
                  opening <FORM> and closing </FORM> tags. The syntax for using the <FORM> tag is as follows:

                              <FORM> Form Elements </FORM>
                  The <FORM> tag has three main attributes, which are:

                  •  ACTION: This attribute is used to specify the action that will take place when we submit
                     the form values. It takes the URL of another web page or an e-mail address to receive the
                     information.
                  •  METHOD: It specifies the type of method the form will use to accept the values entered into
                     form fields. The most commonly used values for this attribute are POST and GET.

                  •  ENCTYPE: It specifies that how a browser decodes the data before submitting to the server. It
                     takes any one value from the following values:
                       ◦ application/x-www-form-urlencoded: It is the standard method used in filling the most
                       forms. All characters are encoded before submitting the form.

                       ◦ multipart/form-data: It is used when you have something to upload like files of images,
                       documents, etc. It does not encode any character.
                  The <INPUT> Tag

                  The <INPUT> tag is one of the most important form elements. It is used to create controls or
                  fields to take input from the user in the form of text, selection, and click. The <INPUT> tag has
                  the following attributes:
                  •  TYPE: This attribute is used to specify the type of field we want to create. It takes one of the
                     predefined values. The predefined values for this attribute are:

                       ◦ TEXT: This value is used to create a text box field. A text box field is a one-line text input
                       control. The text is the default value of the TYPE attribute.

                       ◦ RADIO: This value is used to create a radio button control. A radio button control is used
                       to select only one option from a set of options.
                       ◦ CHECKBOX: This value is used to create a check box control. A check box control allows us
                       to select multiple options from a set of options.
                       ◦ BUTTON: This value is used to create an action button control. An action button control is
                       used to perform an action on the click of it.




                   132
                         iPlus (Ver. 2.0)-VII
   129   130   131   132   133   134   135   136   137   138   139