0% found this document useful (0 votes)
26 views

Courses-322176 (Section-1, Content-5Chapter 5 Form in HTML PDF

The document discusses HTML forms and form elements. It defines common form elements like text boxes, checkboxes, radio buttons, drop-down menus, and buttons. It also explains how to add these elements and some of their attributes in HTML code.

Uploaded by

aaravstudy24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Courses-322176 (Section-1, Content-5Chapter 5 Form in HTML PDF

The document discusses HTML forms and form elements. It defines common form elements like text boxes, checkboxes, radio buttons, drop-down menus, and buttons. It also explains how to add these elements and some of their attributes in HTML code.

Uploaded by

aaravstudy24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Click Here To Go On Full Playlist | Click Here To Download App

Chapter 5
Form in HTML
 Text box  Drop-down List
 Checkbox  Combo box,
 Radio button  Text area
 Password box  Submit button, and
 File input  Reset button

Q1: What is Form in html?


Ans: An HTML form is used to collect user input. The user input is
most often sent to a server for processing. Form starts with the
<form> tag and ends with the </form>
Q2: How to create HTML form?
Ans: HTML form begins with <form> tag and ends with the
</form> tag. It also includes some input elements or form
controls, like, text box, checkbox, radio password etc.
<form>
Input elememt or form controls
</form>
Q3: What is Action and method attribute in HTML form?
Ans:
Action: Specifies where to send the form-data when a form is submitted.
Method: It Specifies that how the form information should be posted to the URL given in
the action attribute. Values of method are: GET and POST
GET POST
Appends the form data to the URL, in Appends the form data inside the body of
name/value pairs. the HTTP request (the submitted form data
is not shown in the URL)
The length of a URL is limited (2048 POST has no size limitations, and can be
characters) used to send large amounts of data.
GET is good for non-secure data POST is good for data security.
Q4: Write name of some Input elements or form controls.
Ans:
 Text box  Drop-down List
 Checkbox  Combo box,
 Radio button  Text area
 Password box  Submit button, and
 File input  Reset button

Q5: Explain some attributes of Input elements?


Ans:
1) Type: This attribute defines what kind of form control will be added to the form.
2) Name: The name attribute specifies the name of an <input> element.
3) Value: It specifies the initial value for th element.
4) Size: it specifies the width of the input field.
5) Maxlength: It specifies the maximum number of characters for the input field.
6) Checked: It determines that the checkbox or radio button should be pre-selected when
the web page loads.
7) Selected: It is use to show pre-selected option in Select option list, when the web page
loads.
Q6: What is Text box or Single line text field? How to add a TEXT BOX?
Ans: Text box allows a user to enter alphanumeric data in single line. We can use it to take
name, email id, phone no. etc.
<input type=”text” name=”firstName”>
Q7: What is Password box? How to add a PASSWORD BOX?
Ans: Password Box means whatever the user enters into this field does not get displayed.
It is use to take Password, OTP, PIN No. of ATM etc.
<input type=”Password” name=”Password”>

Q8: What is Radio Box? How to add a RADIO BOX?


Ans: It is used when a user has to make a selection of only one option among the several
possible options.
<input type=”Radio” name=”Gender”>

Q9: What is Check Box? How to add a CHECKBOX?


Ans: It is used when a user has to make selection of more than one option among the
several possible options.
<input type=”checkbox” name=”subject”>
Q10: What is Drop-down List or Select List or Select option? How to add a DROP-DOWN
LIST?
Ans: A drop-down list displays a list of options from which a user can select an items.
<select name=”City” >
<option> chadigarh<option>
<option> Kolkata<option>
<option> Bhopal<option>
<option> Patna<option>
<select>

Q11: What is Combo box? How to add a Combo Box?


Ans: A combo box is also a drop down list, but with a scroll feature added to it.
<select name=”City” size=3>
<option> chadigarh<option>
<option> Kolkata<option>
<option> Bhopal<option>
<option> Patna<option>
<select>

Q11: What is Multi-Select Option? How to add a Multi-Select Option?


Ans: A Multi select option displays a list of options from which a user can select more than
one option.
<select name=”City” multiple >
<option> chadigarh<option>
<option> Kolkata<option>
<option> Bhopal<option>
<option> Patna<option>
<select>

Q12: How to add Multi line text field or Textarea?


And: Text area is used to accept several lines of text from the user.
<textarea rows=10 cols=60 name=”address”> </textarea>
Rows attribute define the height of the teaxarea.
Cols attribute defines the width of textarea.
Q13: How to add Buttons?
Ans: There are two type of button in forms:
1) Submit Button : After clicking submit button data is sended to next page which is
metioned in action attribute.
<input type=”submit” value=”send”>
2) Reset Button: It is used to clear all the content of form.
<input type=”reset” value=”reset”>

Q14: Write HTML code to create a form with all basic input elements?
Ans:
<form>
Name: <input type=”text” name=”first name”> <BR>
Password: <input type=”Password” name=”Password”> <BR>
Gender:
M <input type=”radio” name=”G” > F <input type=”radio” name=”G” > <BR>
Subject:
Maths: <input type=”checkbox” name=”S1” >
English: <input type=”checkbox” name=”S2” >
Science: <input type=”checkbox” name=”S3” > <BR>

Address: <textarea rows=10 cols=60 name=”Address”> </textarea> <BR>

City:
<select name=”City” >
<option> chadigarh<option>
<option> Kolkata<option>
<option> Bhopal<option>
<option> Patna<option>
<select>
<BR>

<input type=”submit” value=”send”> <input type=”reset” value=”reset”>


</form>

You might also like