What are forms and its attributes in HTML:

Forms and its attributes, what are forms in html, form attributes in html, form attribute values, form definition, form sub tags, form sub tag attributes, form sub tag attribute values,

What are forms and its attributes in HTML:

                                   An HTML Form provides data gathering functionality to a web page. That is, Forms are used to take keyboard input from the user. HTML From provides a full range of GUI controls like text field, button, check box and radio button etc. The data, what the user enters in these controls can easily be collected and submitted to the Web server.

The sub tags which are used under <FORM>....</FORM> tags are stated below.

  • BUTTON (INPUT TYPE=BUTTON) :   Insert a button in the html page.
  • CHECK BOXES (INPUT TYPE=CHECKBOX) :   Insert a check box in the form.
  • RADIO BUTTONS (INPUT TYPE=RADIO) :   Insert a radio button in the form.
  • RESET BUTTON (INPUT TYPE=RESET) :   Insert a reset button in the form.
  • SUBMIT BUTTON (INPUT TYPE=SUBMIT) :   Insert a submit button in the form. When user clicks this button, it automatically transfer the data into the database.
  • TEXT FIELDS (INPUT TYPE=TEXT) :   Insert a text field in the form. User can insert or edit data in this area.

The most common uses of Forms includes comment response forms, order entry forms, subscription forms, registration forms and customization forms.

A common response is generally used as a way to collect comments from, Web site viewers or improvement suggestions from people. Order entry forms, which are now common on the Web provides a way for viewers to order goods from online shopping. Order entry forms typically require the user to provide an address, credit card number, and other information necessary to facilitate online commerce.

Many sites are adopting subscriber forms, particularly those that attempt to generate revenue through direct subscription or by selling advertising space. Registration forms are used to collect information about a user and are tied to an authentication system, which limits access to the site.

The customization form allows users to specify what topics they are interested in within an online magazine. When ties to an authentication system, a user accusing the site views a version set according to his or her tastes.

The Form creation process is actually of two folds. The first part, generally called as front-end, uses <FORM>....</FORM> tags to create GUI controls. The second part of the process involves writing code in a scripting language to learn and write and includes many built-in functions that can process the data from the Form controls. This second part of the process is called the back end.

JavaScript allows the validation of data entered into a Form at the client side. JavaScript can be used to ensure that only valid data is returned to a web server for processing.

Attributes of Form Tag:
                                          The <FORM>....</FORM> tags are used to create an HTML form. HTML elements used to receive to data, such as text fields, buttons, lists etc., are specified as attributes of the <INPUT> tag used within the <FORM>...</FORM> tags. The <FORM> tag tells a browser that there is a fill-in-the-blank from in this HTML document. The <FORM> tag has attributes like NAME, METHOD and ACTION etc.

NAME:
              The NAME attribute is used to give a name to the Form. Since any number of <FORM>...</FORM> tags can be used in one HTML document, JavaScript should be able to differentiate the data from which Form the data is coming. With Name attribute, we can assign names to Forms. These names are used as references by JavaScript to refer the forms later.

                               EXAMPLE : <FORM NAME = f1>

METHOD:
                     The METHOD attributes of a Form is used to specify the method used to send data captured by various form elements back to the Web server. The two acceptable methods are GET and POST.

GET:
           The GET method sends the data captured by Form elements to the Web server whose address is written as URL in ACTION attribute. That is, the URL refers to the address of the web server. The data captured in form elements is appended to the URL. The GET method is used when there is a small amount of data to be sent to the Web server. The maximum amount of data that can be sent to the Web server using this method is limited to a maximum of 1024 bytes.

POST:
             The POST method sends sends the data captured by form elements to the Web server as a separate bit-stream of data. When there is a large amount of data to be sent to the server exists, this method is used.

If the METHOD attribute is not specified within the <FORM> tag, the default method (used by the browser to send data to the Web server) is GET method.

ACTION:
                  The action attribute of the <FORM>.....</FORM> tags refers to the URL of the Web server to where the data of the Form is to be sent. Upon the receipt of the data from the client, a JavaScript program is invoked to process the data. The commonly used Web server side scripting language are JavaScript, VB Script and PERL etc.

ENCTYPE:
                     The ENCTYPE attribute specifies how the data is to be encoded. This attribute is used only with the POST method. As on to day it supports only one value (default also): "application/w-www-form-urlencode".

       The METHOD, ACTION and ENCTYPE attributes are all optional.

               EXAMPLE :  <FORM NAME = f1 METHOD = POST ACTION = "/cgi-bin/myScript">



0 comments:

Copyright © 2013. BloggerSpice.com - All Rights Reserved
Customized by: MohammadFazle Rabbi | Powered by: BS
Designed by: Tilabs