forms Flashcards
Name the attributes of form in HTML5.
autocomplete and novalidate
Give any three input attributes’ names.
autocomplete autofocus form formaction formenctype formmethod formnovalidate formtarget height and width list min and max multiple pattern (regexp) placeholder required step
Is input attribute “form” supported in IE?
It is not supported in IE.
Which web browsers support the input attribute “autofocus”?
Input attribute “autofocus” is supported by Firefox, Opera and Chrome.
Does Opera support the input attribute “novalidate”?
Starting from version 11, Opera supports the input attribute “novalidate”.
What does autocomplete attribute do?
he autocomplete attribute specifies that the form or input field should have an autocomplete function.
You have a form with multiple fields. You wish to automatically get focus on a field when a page gets loaded. Which field attribute will you use?
The autofocus attribute will be used.
e.g. ‹form›
‹input name=”q” autofocus›
‹input type=”submit” value=”Search”› ‹/form›
Does autofocus attribute work with all input types?
Yes, autofocus attribute works with all input types.
What does form attribute do?
The form attribute is used to specify one or more forms.
Give an example of form attribute.
‹form action=”from1.asp” method=”get” id=”form1”›
First name:‹input type=”text” name=”fname” /› ‹input type=”submit” /›
What does form override attribute do?
Some of the attributes set for the form element can be overridden using override attribute.
Explain the types of override attributes.
a) formaction - overrides the form action attribute
b) formenctype - overrides the form enctype attribute
c) formmethod - overrides the form method attribute
d) formnovalidate - overrides the form novalidate attribute e) formtarget - overrides the form target attribute
What is the main function of the override attribute types?
Override attribute types are helpful for creating different submit buttons.
Which attributes can be used to specify the dimensions of an image used for the input type image?
The height and width attributes specify the height and width of the image used for the input type image.
Give an example of input type image using width and height attributes.
‹input type=”image” src=”img_submit.gif” width=”24” height=”24” /›
What does a list attribute do?
The list attribute specifies a datalist for an input field.
[input list=”browsers”]
[datalist id="browsers"] [option value="Internet Explorer"] [option value="Firefox"] [option value="Chrome"] [option value="Opera"] [option value="Safari"] [/datalist]
Name the input attribute’s types with which the attribute “list” works.
The list attribute works with the input types namely text, search, url, telephone, email, date pickers, number, range, and color.
How can you specify minimum and maximum value for an input field?
The min and max attributes of input field can be used to specify the minimum and maximum value for input field.
[form action=”demo_form.asp”]
Enter a date before 1980-01-01:
[input type=”date” name=”bday” max=”1979-12-31”]
Enter a date after 2000-01-01:
[input type=”date” name=”bday” min=”2000-01-02”]
Quantity (between 1 and 5):
[input type=”number” name=”quantity” min=”1” max=”5”]
[input type=”submit”]
[/form]
Which datatypes are compatible with input tag’s min and max attributes?
input tag’s min and max attributes work with numbers or dates.
What does step attribute do?
The step attribute is used to specify legal number intervals for the input field.
What will be the legal allowed values for the following?‹input type=”number” name=”points” min=”0” max=”10” step=”3” /›
0, 3, 6.9
Give an example which shows a numeric field that accepts values between 0 and 10, with a step of 3.
Points: ‹input type=”number” name=”test” min=”0” max=”10” step=”3” /›
Which attribute specifies that multiple values can be selected for an input field?
The multiple attribute
With which input types does the multiple attribute work?
The multiple attribute works with the input type file and email. e.g. Select: ‹input type=”file” name=”img” multiple=”multiple” /›