Sunday, 15 October 2017

HTML Forms are required, when you need to gather a few information from the site guest. For instance, amid client enlistment you might want to gather data, for example, name, email address, charge card, and so on.

A shape will take include from the site guest and afterward will present it on a back-end application, for example, CGI, ASP Script or PHP content and so on. The back-end application will perform required handling on the passed information in light of characterized business rationale inside the application.

There are different shape components accessible like content fields, textarea fields, drop-down menus, radio catches, checkboxes, and so on.

The HTML <form> tag is utilized to make a HTML shape and it has following language structure −

<form action = "Script URL" method = "GET|POST">
   form elements like input, textarea etc.
</form>

Shape/form Attributes 

Aside from basic characteristics, following is a rundown of the most much of the time utilized shape properties −

Sr.NoAttribute & Description
1
action
Backend script ready to process your passed data.
2
method
Method to be used to upload data. The most frequently used are GET and POST methods.
3
target
Specify the target window or frame where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.
4
enctype
You can use the enctype attribute to specify how the browser encodes the data before it sends it to the server. Possible values are −
application/x-www-form-urlencoded − This is the standard method most forms use in simple scenarios.
mutlipart/form-data − This is used when you want to upload binary data in the form of files like image, word file etc.

Note − You can allude to Perl and CGI for a detail on how shape information transfer functions.

HTML Form Controls 

There are diverse sorts of shape controls that you can use to gather information utilizing HTML frame −


  • Content Input Controls 
  • Checkboxes Controls 
  • Radio Box Controls 
  • Select Box Controls 
  • Document Select boxes 
  • Shrouded Controls 
  • Interactive Buttons 
  • Submit and Reset Button 


Content Input Controls 

There are three sorts of content information utilized on shapes −

Single-line content information controls − This control is utilized for things that require just a single line of client input, for example, look boxes or names. They are made utilizing HTML <input> tag.

Secret key info controls − This is additionally a solitary line content information yet it covers the character when a client enters it. They are likewise made utilizing HTMl <input> tag.

Multi-line content information controls − This is utilized when the client is required to give points of interest that might be longer than a solitary sentence. Multi-line input controls are made utilizing HTML <textarea> tag.

Single-line content info controls 

This control is utilized for things that require just a single line of client input, for example, look boxes or names. They are made utilizing HTML <input> tag.

Case 

Here is an essential case of a solitary line content information used to take initially name and last name −

<!DOCTYPE html>
<html>

   <head>
      <title>Text Input Control</title>
   </head>
 
   <body>
      <form >
         First name: <input type = "text" name = "first_name" />
         <br>
         Last name: <input type = "text" name = "last_name" />
      </form>
   </body>
 
</html>

Properties 

Following is the rundown of properties for <input> tag for making content field.

Sr.NoAttribute & Description
1
type
Indicates the type of input control and for text input control it will be set to text.
2
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
3
value
This can be used to provide an initial value inside the control.
4
size
Allows to specify the width of the text-input control in terms of characters.
5
maxlength
Allows to specify the maximum number of characters a user can enter into the text box.

Secret word/password input controls 

This is additionally a solitary line content info however it veils the character when a client enters it. They are additionally made utilizing HTML <input>tag however sort ascribe is set to secret key.

Case 

Here is an essential case of a solitary line secret word input used to take client watchword −

<!DOCTYPE html>
<html>

   <head>
      <title>Password Input Control</title>
   </head>
 
   <body>
      <form >
         User ID : <input type = "text" name = "user_id" />
         <br>
         Password: <input type = "password" name = "password" />
      </form>
   </body>
 
</html>

Qualities 

Following is the rundown of qualities for <input> tag for making secret word field.

Sr.NoAttribute & Description
1
type
Indicates the type of input control and for password input control it will be set to password.
2
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
3
value
This can be used to provide an initial value inside the control.
4
size
Allows to specify the width of the text-input control in terms of characters.
5
maxlength
Allows to specify the maximum number of characters a user can enter into the text box.
Different Line Text Input Controls 

This is utilized when the client is required to give subtle elements that might be longer than a solitary sentence. Multi-line input controls are made utilizing HTML <textarea> tag.

Case 
Here is an essential case of a multi-line content information used to take thing portrayal −

<!DOCTYPE html>
<html>

   <head>
      <title>Multiple-Line Input Control</title>
   </head>
 
   <body>
      <form>
         Description : <br />
         <textarea rows = "5" cols = "50" name = "description">
            Enter description here...
         </textarea>
      </form>
   </body>
 
</html>

Properties 

Following is the rundown of properties for <textarea> tag.

Sr.NoAttribute & Description
1
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
2
rows
Indicates the number of rows of text area box.
3
cols
Indicates the number of columns of text area box
Checkbox Control 

Checkboxes are utilized when more than one alternative is required to be chosen. They are additionally made utilizing HTML <input> tag however sort ascribe is set to checkbox..

Illustration 

Here is an illustration HTML code for a shape with two checkboxes −

<!DOCTYPE html>
<html>

   <head>
      <title>Checkbox Control</title>
   </head>
 
   <body>
      <form>
         <input type = "checkbox" name = "maths" value = "on"> Maths
         <input type = "checkbox" name = "physics" value = "on"> Physics
      </form>
   </body>
 
</html>

Characteristics 

Following is the rundown of characteristics for <checkbox> tag.

Sr.NoAttribute & Description
1
type
Indicates the type of input control and for checkbox input control it will be set to checkbox..
2
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
3
value
The value that will be used if the checkbox is selected.
4
checked
Set to checked if you want to select it by default.
Radio Button Control 

Radio catches are utilized when out of numerous alternatives, only one choice is required to be chosen. They are likewise made utilizing HTML <input> tag yet sort credit is set to radio.

Illustration 

Here is illustration HTML code for a shape with two radio catches −

<!DOCTYPE html>
<html>

   <head>
      <title>Radio Box Control</title>
   </head>

   <body>
      <form>
         <input type = "radio" name = "subject" value = "maths"> Maths
         <input type = "radio" name = "subject" value = "physics"> Physics
      </form>
   </body>

</html>

Traits 

Following is the rundown of traits for radio catch.

Sr.NoAttribute & Description
1
type
Indicates the type of input control and for checkbox input control it will be set to radio.
2
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
3
value
The value that will be used if the radio box is selected.
4
checked
Set to checked if you want to select it by default.

Select Box Control 

A select box, likewise called drop down box which gives alternative to list down different choices as drop down rundown, from where a client can choose at least one choices.

Case 

Here is case HTML code for a frame with one drop down box

<!DOCTYPE html>
<html>

   <head>
      <title>Select Box Control</title>
   </head>
 
   <body>
      <form>
         <select name = "dropdown">
            <option value = "Maths" selected>Maths</option>
            <option value = "Physics">Physics</option>
         </select>
      </form>
   </body>
 
</html>

Characteristics 

Following is the rundown of critical properties of <select> tag −

Sr.NoAttribute & Description
1
name
Used to give a name to the control which is sent to the server to be recognized and get the value.
2
size
This can be used to present a scrolling list box.
3
multiple
If set to "multiple" then allows a user to select multiple items from the menu.

0 comments:

Translate

GoogleTech786. Powered by Blogger.

Subscribe Youtube

Our Facebook Page

Wikipedia

Search results

Popular Posts

Adsense