VKS-LEARNING HUB

Home » Class-XI » MMWT-XI » Starting HTML » Forms

Forms

A form is the central object that manages the other controls. Although the controls can send their data to a script, a form can be used to collect the values typed or selected on the controls, gather them as if they constituted one control and make these values available to a validating file on a server.

Creating a Form

To create a form, you use the <form> tag. Because a form is a collection of controls and their values, the form must have an end that lets the browser know where the form closes. This is done with the </form> closing tag as follows: <FORM> </FORM> Everything between the <FORM> and the </FORM> tags belong to the form and is called the body of the form. Almost anything can go in the body of the form. You can design it using any HTML tag and make it as attractive as you wish Although the <form> and the </form> tags are enough to create a form, such a form can hardly communicate with a script. One of the most important characteristics you should set for a form is its name. The name allows a script to refer to the form and it can be used by files on the server. To set the name of a form, assign an appropriate string to the Name attribute of the <form> tag

Different Forms Elements

<INPUT> tag   Using <INPUT Type (Attribute) wecan create textbox,password box, radio button,checkbox,Buttons, reset button ,submit buton etc.)

<TEXTAREA> tag for creating multiline text areas of input

<SELECT> tag  for creating dropdown list and menus boxes

INPUT Tag is used to tell browser that user input will occur here. User can input values using different interface element. All these elements like Radio Button, textbox,Checkbox, buttons are created using TYPE Attribute with Input tag Other

Important Attribute you must use with Input Tag are Name & Value with all Interface elements , Other attribute are interface specific

To create a Text Box  :               <input type=”text”>

To create a Radio Button  :      <input type=”radio”>

To create a Checkbox  :            <input type=”Checkbox”>

To create a Password box  :    <input type=”Password”>

To create a Simple Button:      <input type=”Button”>

To create a Submit Button  :  <input type=”Submit”>

To create a Reset Button  :     <input type=”reset”>

To create a Image Box  :         <input type=”Image”>

To create a File Field  :               <input type=”file”>

To create a Hidden Field  :       <input type=”hidden”>

Input Elements Attribute   Attribute   Attribute   Attribute  

Attribute

 

Text box type=”text” name=”txt1” value=”Enter Name ” Size=”50” Maxlength=”30”
Name : <input type=”text” name=”txt1” size=”20″>
Password type=”password” name=”P1” value=”Enter name ” Size=”50” Maxlength=”10”
Password:<input type=”text” name=”P1″ size=”20″ Maxlength=”8”>
Radio Button type=”radio” name=”RB” value=”Male” checked  
Gender :< input type=”radio” name=”RB” value=”Male”  checked > Male               < input type=”radio” name=”RB” value=”Female”   >Female
Checkbox type=”checkbox” name=”chk1” value=”red” checked  
Interest :<input type=”checkbox” name=”chk1″ value=”Reading” checked> Reading                                <input type=”checkbox” name=”chk2″ value=”Singing” checked> Singing                                                            <input type=”checkbox” name=”chk3″ value=”Cooking” > Cooking
Button type=”Button” name=”B1” value=”click here”    
< input type=”Button” name=”B1″ value=””Click here” >
Submit Button type=”Submit” name=”SB1” value=”Submit”    
< input type=”submit” name=”SB1″ value=” Submit” >
Reset Button type=”Reset” name=”RSB1” value=”Reset”    
< input type=”Reset” name=”RSB1″ value=” Reset” >
Image button type=”Image” name=”img1” SRC=”imag1.jpg” Height=10 Width=20
<input type=”image” src=”desert.jpg”, height=50 width=50 border=1>
< input type=”File” name=”file1″ Maxlength=”30”>

2 Comments

  1. sir could your please tell me again about the creation of form and i wont be able to come on 1 st jan 2013 AND HAPPY NEW YEAR

    • vinsri76 says:

      Dear Fahad

      Go through the Form option under Class XI–> MMWT-XI–HTML–FOrm
      Read and try the code on notepad

Leave a comment