HTML FORMS Flashcards
What is the natural use of HTML Forms?
HTML Forms are mostly used to collect user inputs
What tag do you use to create an HTML Form?
“form” tags
What are some HTML Form attributes?
action, autocomplete, method, novalidate, target
What does the “action” attribute for an HTML Form do?
The “action” attribute defines the action to be performed when the form is submitted.
What does the “target” attribute for an HTML Form do?
The “target” attribute specifies where to display the response that is received after submitting the form
What are the values the “target” attribute for an HTML Form can have and what do they mean?
“_blank” - the response will be displayed in a new window or tab
“_self” - the response will be displayed in the current window
“_parent” - the response will be displayed in the parent frame
“_top” - the response will be displayed in the full body of the window
framename - the response will be displayed in a named iframe
What does the “method” attribute for an HTML Form do?
The “method” attribute specifies the HTTP method to be used when submitting the form data
What does the “autocomplete” attribute for an HTML Form do?
The autocomplete attribute specifies whether a form should have autocomplete on or off
What does the “novalidate” attribute for an HTML Form do?
The “novalidate” attribute is a boolean attribute, that when present specifies that the form-data should not be validated when submitted
What does the “label” element do?
The “label” element defines a label for form elements
What attribute should be added to the “label” element to bind it to another form element, and how should it be done?
The “for” attribute of the “label” element should be added and should be equal to the “id” attribute of the “input” element to bind them together
What element defines a drop-down list?
The “select” element
For drop-down list, what element is used to create new items in the drop-down list?
The “option” element defines an option that can be selected, adding another item to the drop-down list
What attribute is added to a drop-down item to make it the pre-selected item?
The “selected” attribute
How would you create a drop-down list with 4 visible values?
“select size=’4’”
What does it mean if the drop-down list has the “multiple” attribute added to it?
The “multiple” attribute allows the user to select more than one value
What does the “textarea” element do?
The “textarea” element defines a multi-line input field
How would you define the width and height of the “textarea” element without CSS?
By using the “rows” and “cols” attribute.
“Rows” specifies the visible number of lines.
“Cols” specifies the visible width.
How would you create a button in a form?
By using the “button” element
What tags do you use to create a group within a form and label that section?
Used the “fieldset” element to group related data in a form and label that group with the “legend” element
What is the “output” element for in an HTML form?
The “output” element represents the results of a calculation
What input type defines a single-line text input field?
input type=”text”
What input type defines a password field?
input type=”password”
What input type defines a button for submitting form data to a form-handler?
input type=”submit”
What input type defines a button that will reset all form values to their default values?
input type=”reset”
What input type defines a set of radio buttons and how do you set it up?
input type=”radio”
By creating the radio button and follow that with a label tag to add the text next to the button