HTML Forms Flashcards
What is an <em>HTTP request</em>?
The thing that instructs the computer how to handle incoming information
What does the < form > element do?
Collects information
What attributes does the < form > element need?
action and method
What does the action attribute do?
determies where the information is sent
What does the method attribute do?
It is assigned an HTTP verb and is included in the HTTP request
How do you add a text box for typing on a form
With the < imput > element
What attributes does the < input > element need?
The type attribute, the value attribute and the name attribute
What does the type attribute do?
It tells the computer what type of information is coming in, typically you would write “text”?
What does the name attribute do
Helps the browser know what to do with the information, just write “first-text-field”
What does the value attribute do?
Puts text in the text box
What element is used to add a label to the textbox?
A < label > element
How does the < label > element know which text box to label?
By assigning the < label > element a for attribute, you can give the input element the id attribute and make them the same
How do you make a password forum?
Add the attribute type=”password”
How do you restrict the person to type only numbers?
By setting type to numbers
What does the step attribute do?
It makes up and down arrows in the text box which allows you to increase and decrease the numbers
How do you make a range imput?
By setting type to range, you also must include the min and max
How do you make a checkbox?
Set type to checkbox
What are Radio Button Inputs?
Inputs with only one answer, unlike check boxes where you can choose multiple. You make a radio button input by setting the type to radio
How do you make a drop down list?
Use the select element with the id and name, and then add child option elements are write the name inside them, remember to also set to value to that name
What is a datalist?
A data list is like a drop down list but users can type into it
How do you make a datalist?
Use the input element, and add the attribute “list” and set it to the id of the data list and set the type attribute to text. Then add children elements to the data list element and those will show
How do you change the size of a textarea box?
With the rows and cols attributes
How do you add a value to the textarea box?
By putting it in between the opening and closing tabs.