0% found this document useful (0 votes)
11 views12 pages

Q3 MODULE3 G10 PROGRAMMING MANGALDAN-NHS-Final

This module teaches Grade 10 students about HTML form controls, including how to create forms, textboxes, password fields, text areas, and checkboxes. It covers the structure of HTML forms, the use of the <input> element, and various types of input controls with examples and attributes. Additionally, it includes activities and evaluations to reinforce learning.
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)
11 views12 pages

Q3 MODULE3 G10 PROGRAMMING MANGALDAN-NHS-Final

This module teaches Grade 10 students about HTML form controls, including how to create forms, textboxes, password fields, text areas, and checkboxes. It covers the structure of HTML forms, the use of the <input> element, and various types of input controls with examples and attributes. Additionally, it includes activities and evaluations to reinforce learning.
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/ 12

Grade

10
TVL- ICT
COMPUTER PROGRAMMING
QUARTER 3 – MODULE 3
HTML – FORM CONTROLS

Prepared by:

EUGENIO L. MOLINA
Teacher III
Mangaldan National High School
QUARTER III
WEEK III

I. LEARNING OBJECTIVES

After reading this module you will be able to understand how to create form, textbox,
password, text area and checkbox and identify their different attributes.

II. INTRODUCTION

HTML Forms are required when you want to collect some data from the site visitor. For
example, during user registration you would like to collect information such as name, email
address, credit card, etc. There are various form elements available like text fields, textarea
password, and checkboxes.

III. READINGS/LECTURES

HTML Form Structure


The HTML <form> tag defines a form that is used to collect user input. All the form
elements should be written inside <form> and </form> tags.

Syntax:
<form>
....
Form Elements..
....
</form>

HTML Form Controls

There are different types of form controls that you can use to collect data using HTML form

• Text Input Controls


• Checkboxes Controls
• Radio Box Controls
• Select Box Controls
• File Select boxes
• Hidden Controls
• Clickable Buttons
• Submit and Reset Button

1
HTML Forms Element

The 'Input' Element


The most important form element is the <input> element. The <input> element can be
displayed in several ways, depending on the type attribute.

Example

<!DOCTYPE html>
<html>
<head>
<title> HTML Form Input Attribute </title>
</head>
<body>
<form>
First name:
<input type="text" name="firstname">
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>

This will produce the following result

Note: The default width of a text input field is 20 characters.

Text Input Controls

There are three types of text input used on forms.


• Single-line text input controls − This control is used for items that require only one
line of user input, such as search boxes or names. They are created using
HTML <input> tag.

• Password input controls − This is also a single-line text input but it masks the
character as soon as a user enters it. They are also created using HTML <input> tag.

2
• Multi-line text input controls − This is used when the user is required to give details
that may be longer than a single sentence. Multi-line input controls are created using
HTML <textarea> tag.

Single-line text input controls

This control is used for items that require only one line of user input, such as search
boxes or names. They are created using HTML <input> tag.

Example

Here is a basic example of a single-line text input used to take first 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>
This will produce the following result

Here is the list of attributes for <input> tag for creating text field.

Attribute & Description

type
Indicates the type of input control and for text input control it will be set to text.

Name
Used to give a name to the control which is sent to the server to be recognized and get the
value.

Value
This can be used to provide an initial value inside the control.

3
Size
Allows to specify the width of the text-input control in terms of characters.

Maxlength
Allows to specify the maximum number of characters a user can enter into the text box.

Password input controls

This is also a single-line text input but it masks the character as soon as a user enters
it. They are also created using HTML <input>tag but type attribute is set to password.

Example
Here is a basic example of a single-line password input used to take user password

<!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>
This will produce the following result

Here is the list of attributes for <input> tag for creating password field.

Attribute & Description

type
Indicates the type of input control and for password input control it will be set
to password.

name
Used to give a name to the control which is sent to the server to be recognized and get
the value.

4
value
This can be used to provide an initial value inside the control.

size
Allows to specify the width of the text-input control in terms of characters.

maxlength
Allows to specify the maximum number of characters a user can enter into the text box.

Multiple-Line Text Input Controls

This is used when the user is required to give details that may be longer than a single
sentence. Multi-line input controls are created using HTML <textarea> tag.

Example
Here is a basic example of a multi-line text input used to take item description

<!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>
This will produce the following result

5
Here is the list of attributes for <textarea> tag.

Attribute & Description

name
Used to give a name to the control which is sent to the server to be recognized and
get the value.

rows
Indicates the number of rows of text area box.

cols
Indicates the number of columns of text area box

Checkbox Control

Checkboxes are used when more than one option is required to be selected. They are
also created using HTML <input> tag but type attribute is set to checkbox.

Example
Here is an example HTML code for a form with two checkboxes

<!DOCTYPE html>
<html>

<head>
<title>Checkbox Control</title>
</head>

<body>
<form>
<input type = "checkbox" name = "math" checked> Math
<input type = "checkbox" name = "physics"> Physics
</form>
</body>

</html>
This will produce the following result

6
Here is the list of attributes for <checkbox> tag.

Attribute & Description

type
Indicates the type of input control and for checkbox input control it will be set
to checkbox.

name
Used to give a name to the control which is sent to the server to be recognized and get
the value.

value
The value that will be used if the checkbox is selected.

checked
Set to checked if you want to select it by default.
ACTIVITY 1: Identify whether the given attribute is for Input, Text Area or Checkbox.
Write your answers in your answer sheet.
1. maxlength 6. rows
2. cols 7. checked
3. name 8. type”=checkbox”
4. size 9. value
5. cols=”60” 10. type=”password”

7
SUMMATIVE EVALUATION

A. Identify what is being asked or described by the following statements. Choose


your answer inside the box and write it in your answer sheet.

1. A tag that defines a form that is used to collect user input.


2. This element can be displayed in several ways, depending on the type attribute.
3. This is also a single-line text input but it masks the character as soon as a user
enters it
4. This is used when the user is required to give details that may be longer than a
single sentence

5. Multi-line input controls are created using this HTML tag.

6. Indicates the type of input control and for text input control it will be set to text.

7. Set to checked if you want to select it by default.

8. Allows to specify the maximum number of characters a user can enter into the text
box.
9. This can be used to provide an initial value inside the control.
10. This is also a single-line text input but it masks the character as soon as a user
enters it.

<form> password input control value

single-line multi-line <textarea>

checked input type maxlength

B. Copy the given HTML codes and encircle the error(s). Write your answer in your
answer sheet.

1. <input value = "text" name = "user_id" />

2. <textarea rows = "5" cols = "password" name = "description">


3. Password: <input type = "text" name = "password" />
4. <input type = "checkbox" name = "physics" value = "50">
5. <textarea rows = "name" cols = "on" name = "text">

8
C. Create the HTML Code for the following. Write them in your answer sheet.
1.

CODE:

2.

CODE:

9
Key Answer

1. Input
2. Text Area
3. Input / Text Area / Checkbox
4. Input
5. Text Area
6. Text Area
7. Checkbox
8. Checkbox
9. Input / Checkbox
10. Input

Reference: https://www.tutorialspoint.com/html/html_comments.htm
Learn to Code HTML & CSS –Develop and Style Website by: Shay Howe

10
ANSWER SHEET

NAME: ________________________________________ Score: ____________________


Gr. & Sec: ___________________ Subj. Teacher: _______________________________

11

You might also like