Lectures-web

248 views

Published on

HTML Forms

Published in: Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
248
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lectures-web

  1. 1. Forms A form is an area that can contain form elements. Form elements Form elements are elements that allow the user to enter information (like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.
  2. 2. A form is defined with the <form> tag. Like <form> . input elements . </form> Example <form> First name: <input type="text" name="firstname" /> <br /> Last name: <input type="text" name="lastname" /> </form>
  3. 3. Input Elements and the INPUT tag The most used form tag is the <input> tag. The type of input is specified with the type attribute. The available types are •Text Fields •Radio Buttons •Checkboxes •Submit Buttons •Reset Buttons
  4. 4. Text Fields Text fields are used when you want the user to type letters, numbers, etc. in a form. Example <form> First name: <input type="text" name="firstname" /> <br /> Last name: <input type="text" name="lastname" /> </form>
  5. 5. Radio Buttons Radio Buttons are used when you want the user to select one of a limited number of choices. Example <form> <input type="radio" name="sex" value="male" /> Male <br /> <input type="radio" name="sex" value="female" /> Female </form>
  6. 6. Checkboxes Checkboxes are used when you want the user to select one or more options of a limited number of choices. Example <form> I have a bike: <input type="checkbox" name="vehicle" value="Bike" /> <br /> I have a car: <input type="checkbox" name="vehicle" value="Car" /> <br /> I have an airplane: <input type="checkbox" name="vehicle" value="Airplane" /> </form>
  7. 7. Submit Buttons Submit buttons are used when you want the user to submit the content of the form to the Server. Example <form name="input" action="html_form_submit.asp" method="get"> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> </form> Note The form's action attribute defines the name of the file to send the content to. The file defined in the action attribute usually does something with the received input.
  8. 8. Reset Buttons Reset buttons are used when you want the user to clear the content of the form Example <form name="input" action="html_form_submit.asp" method="get"> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> <input type=“Reset" value=“Reset" /> </form>
  9. 9. The Select list Element and the “SELECT” Tag Select Lists (Drop Down lists ) are used when you want the user to select one of a limited number of choices. Example <form> Gender <SELECT NAME=“gender”> <OPTION>Male <OPTION>Female </SELECT> </form>

×