Friday, November 4, 2022

HTML form tag , Form tag attributes

HTML Form tag




 Introduction Form Tag HTML

  • A form is an object that is used for collectng data from the users.
  • To create from an any webpage we use <form> tag with other tages also.

Sytax of a form tag-

<form methode=" " action=" " >
       <input>
        <input>
</form>

Form Tag Attributes

  • Accept-charset
  • Action
  • Autocomplete
  • Method
  • Enctype
  • Name
  • Navalidate
  • Target

Action Attributes Form Tag

Specifies where to send the form - data when a form is submitted.

Method Attributes Form Tag 

The method attributes specifies how to send form data ( the form - data is send to the page specified in the action attribute.)

GET and POST Method

Get Method
  • Appends form-data into the URL in name /value pairs
  • The length of a URL is Limited ( about 3000 characters)
  • Never use GET to send sensitive data ( will be visible in the URL )
  • Useful for form submission where a user want to bookmark the result.
Post Method
  •  Appends form - data inside the body of the HTTP request (data is not show is in URL )
  • It has no size limitations
  • Form submission with POST cannot be bookmarked .

Accept - Charset Attributes Form tag

Specifies the character encoding that are to be used for the form submission.

Enctype Attributes From tag 

Specifies how to form data should be encoded when submitting it to the server. (only for method = "post" )

Enctype Attributes Values 

  1. application/x-www-form-urlncoded  -     Default. All characters are encoded before sent ( spaces are converted to "+" symbols , and special characted are converted to ASCII HEX Values )       
  2. multipart/form-data  -The value is necessary if the user will upload a file through the form.
  3. text/plain - Sends data without any encoding at all. Not recommended.
 

Name Attributes 

Specifies the name of a form.

Novalidate Attributes

Specifies that the form should not be validate when sumitted .

Target Attributes

Specifies where to display the respone that is recived after submitting form.

Target Attributes Values

Value                Description

_blank               The respones is displayed in a new windows or tab
_self                  The response is displayed in the same frame ( this is default )
_parent              The response is disp;ayed in the parent frame.
_top                   The response is displayed in the full body of the windows.
Framename The response is displayed in a named iframe .
 

No comments: