Tamil Nadu TRB Computer Instructors GRADE1 Exam Syllabus - HTML Part1
PG:TRB computer science computer instructor PG:TRB computer science syllabus
Complete guide to HTML Forms and Form elements
This video explains:
What is HTML form?
Use of HTML form?
How to render HTML form?
HTML form elements?
Different type of html form elements?
How to collect data from user?
Input, Select, textarea, button, form submit
-------------
HTML - Form and Form elements
To collect information from users
form
Attributes:
action - URL, where to submit the form
default current page URL
method - HTTP method
GET - default
POST
name - form name
target - target of the action address
_self default
_blank
_parent
_top
accept-charset - charset used to submit the form
defaualt page charset
enctype - encoding of the submited data (only for POST method)
text/plain - default
application/x-www-form-urlencoded - default for post
multipart/form-data - for file upload
autocomplete - should browser autocomplete the form
on default
off
novalidate - broswser should not validate the form
Form elements:
# input
# textarea
# select
# button
# input
user can enter data
different type of input elements based on "type" attribute
Attributes: (30)
type (22)
button,checkbox,radio,password,reset,submit,text,file,hidden,
color,date,datetime-local,email,image,month,number,range,
search,tel,time,url,week
name
value
maxlength
disabled
readonly
checked
accept - only for "file" type
audio/*
video/*
image/*
media_type
autocomplete
autofocus
# textarea
user can enter multiple lines of data
Attributes:
cols - visible width
rows - visible number of lines
# select
Create a drop-down list
User can choose one or more options from the list
option tag defines options in the list
Attributes:
select
multiple - allows user to choose multiple options
size - number of visible options
option
value - value to sent to server for the option
selected - to specify option to be pre-selected
optiongroup - to group related options in the drop-down list
Attributes:
disabled
label
# button
creates a clickable button
can have text / image (this is the difference input & button)
Attributes:
type - type of button
button
reset
submit
value - initial button text
label - defines the label for the form elements
Attribute:
for - form element id
Field set: To group the form elements
fieldset
form elements to group
legend -- to name the form group elements