What Is A Form
What Is A Form
▪ Form allows you to gather feedback from your readers or visitors and work on the data to provide better service.
▪ Online forms are webpages purposely designed for gathering information on the Internet. These HTML documents are sent back to
the server once the user submits them.
▪ The areas on the form are called fields, text fields or text boxes.
▪ The form also contains command buttons such as Send or Reset buttons. You can also see standard controls such as check buttons
or radio buttons and list boxes.
1. action 2. method
Action attribute
– is responsible for indicating where the information will be passed whether it is to another Web page or to a script.
Method attribute
The get method of sending information appends the data into the URL. More specifically, the get method is just basically for
retrieving data whereas the post method may update or store data.
Note: Using forms leads to effective communication between the user and the webmaster.
Attribute
Action Indicates where the information will be submitted. Filename (path could be included), URL
▪ The form should be both visually appealing and functional, which means that you may need to take care when choosing which key
points to include in a form.
▪ To start building an online form, the container tag <form></form> will be used. Start organizing the form by placing the input empty
tag inside the <form> set of tags and have its attribute type specify the kind of input you are going to have.
Input element
▪ The input element of form is defined by the empty tag <input> is used for making textboxes, password boxes, check boxes, radio
buttons, submit buttons and reset buttons depending on the value of the type attribute.
Note: A form also contains select lists, text areas and others.
Name Assigns a name to the input field. The name can be used for various Any text (without spaces)
type Indicates the type of input field text, password, checkbox, radio, submit, reset
Value Indicates the initial value of the input field. Indicates the label for Any text
Checked Indicates, if by default, the input field (radio button or check box) is None, needs no value. Just needs to be
datetime Allows you to select a date and time. <input type=“datetime” name=“bdaytime”>
range Defines control for entering a number <input type=“range” name=“points” min=“1” max=“10”>
tel Defines a field for entering a telephone number <input type=“tel” name=“usertel”>
URL Used for input fields that should contain a URL address <input type=“url” name=“homepage”>
Other input types are “text”, “password”, “radio”, “checkbox”, “button”, “reset”, “submit”, “hidden”, “image” and “file”. Add
attributes like size, name and value.
Creating a Textbox
▪ Textboxes are used for username input and other single line texts such as names, email addresses, etc.
▪ Can be made by keying in text as the value of the type attribute of the <input>.
Creating a Textbox
▪ You can use the value attribute to set an initial text input.
▪ You can create an input field that can span several rows and columns to allow the readers to enter their feedback, requests,
instructions, opinions or any communication.
▪ The content of this tag will be displayed in the text area by default.
Soft word wrapping – wraps the text only in the text area and not when it is submitted, can be made by keying in soft as the
Hard word wrapping - wraps the text only in the text area and also when it is submitted, can be made by keying in hard as
Word wrapping can be removed by keying in off as the value for the wrap attribute.
• Radio buttons provide the users a variety of choices where only one can be selected.
• Radio buttons can be made by keying in radio as the value of the type attribute of <input>
• In a set of radio buttons, only one can be chosen; the name attribute is also used to indicate which set that radio
button belongs.
• Radio buttons of the same group have similar value for their name attributes
• The checked attribute is applicable for radio buttons to indicate a default selected option. Radio buttons are usually used when the
choices are few.
<p>Please check the products you have used in the past two years.<br></p>
▪ Check boxes offer users a variety of choices where none, only one or many may be selected.
▪ Can be made by keying in checkbox as the value of the type attribute of <input>.
The checked attribute is applicable for check boxes to indicate default selected options.
▪ Like radio buttons, drop-down lists or drop-down menus offer users a variety of choices where only one can be selected.
▪ Individual items in drop-down menus are defined by the container tag <option></option>.
Name Assigns a name to the dropdown menu. The name can be used for any text(without spaces)
The selected attribute is used in dropdown menus to indicate a default selected option.
Value Assigns a name to the dropdown menu item. The name can be used any text(without spaces)
<option>January</option>
<option>February</option>
<option>March</option></select>
▪ Feedback form allows communication with your website’s visitors. Visitors can submit questions and comments which will then be
forwarded to your email address.
▪ Usually placed at the end of forms and when clicked, submits the information input.
▪ It can be made by keying in submit as the value of the type attribute of <input>.
Furthermore, the value of the value attribute indicates the label on the button.
Example: <p><input type=“submit” value=“Submit”>
▪ This can be done by keying in reset as the value of the type attribute of <input>.
• The value of the value attribute indicates the label on the button.
Adding a File
▪ File allows your website visitor to send files in your web server.
▪ File can be made by keying file as the value of the type attribute of <input> while the accept attribute specifies the types of files
that the server accepts (that can be submitted through a file upload).
Note: The accept attribute can only be used with <input type=“file”>
Value Definition
file_extension A file extension starting with the STOP character, ex. .gif, .jpg, .png, .doc