Forms Flashcards

1
Q

Which HTML tag is used to create an HTML form for user input?

A

<form>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which attribute specifies whether a form or an input field should allow the browser to predict the value?

A

autocomplete

EXAMPLES: <form action=”action_page.php” autocomplete=”on”>
<input type=”email” autocomplete=”off”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which attribute specifies that the form input should not be validated when submitted?

A

novalidate

EXAMPLE: <form action=”/action_page.php” novalidate>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which attribute defines the action to be performed when the form is submitted?

A

action

EXAMPLE: <form action=”/action_page.php”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which attribute specifies how form input should be encoded when submitted to the server?

A

enctype

EXAMPLE: <form action=”/action_page_binary.asp” method=”post” enctype=”multipart/form-data”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which attribute specifies the HTTP method to be used when submitting the form data?

A

method

EXAMPLE: <form action=”/action_page.php” method=”get” target=”_blank”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which attribute specifies where to display the response that is received after submitting the form?

A

target

EXAMPLE: <form action=”/action_page.php” method=”get” target=”_blank”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which attribute refers to pre-defined options contained in a datalist?

A

list

EXAMPLE:<input list=”browsers”>
<datalist id=”browsers”>
</datalist>
Which attribute refers to pre-defined options contained in a datalist?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which attributes define the minimum or maximum value for an <input></input> element?

A

min and max

EXAMPLE: <input type=”number” min=”1” max=”5”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which attribute defines the maximum length of input allowed in an <input></input> field?

A

maxlength

EXAMPLE: <input type=”text” maxlength=”4”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which attribute allows the user to enter more than one value in the <input></input> element?

A

multiple

EXAMPLE: <input type=”file” id=”files” multiple>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which attribute checks input into the field against a regular expression, which is a pattern of characters for use in pattern-matching and search-and-replace functions?

A

pattern

EXAMPLE: <input type=”text” pattern=”[A-Za-z]{3}”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which attribute provides a hint to the user of the input value expected in the <input></input> field?

A

placeholder

EXAMPLE: <input type=”tel” placeholder=”123-45-678”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which attribute requires input in the field before the form can be submitted?

A

required

EXAMPLE: <input type=”text” required>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What do we call the process that tests data input to verify whether the input follows a specified format or meets minimum requirements for character number or type?

A

user input validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which pattern ensures the user enters a three digit country code?

A

<input type=”text” pattern=”[A-Za-z]{3}”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which pattern ensures the user enters a date formatted as 1/1/2021?

A

<input type=”text” pattern=”\d{1,2}/\d{1,2}/\d{4}”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which pattern ensures the user enters a valid email address?

A

<input type=”email” pattern=”^.+@.+$”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which pattern ensures the user enters latitude/longitude?

A

<input type=”text” pattern=”-?\d{1,3}.\d+”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which pattern ensures the user enters a price?

A

<input type=”text” pattern=”\d+(.\d{2})?”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which pattern ensures the user enters a URL beginning with https?

A

<input type=”url” pattern=”https?://.+”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which input type displays as round buttons in a group of mutually exclusive pre-determined choices?

A

<input type=”radio”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Which HTML element submits a user’s completed form data to the server for processing?

A

<button type=”submit”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Which HTML element resets the form data to its initial value?

A

<button type=”reset”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Which HTML element creates a clickable button that does not directly affect form data and allows text and images to be placed within its tags?

A

<button type=”button”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Which input type displays as square buttons in a group of pre-determined choices from which the user can select more than one choice?

A

<input type=”checkbox”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Which element creates a rectangular field that can expand upon user interaction and allow users to select one or more pre-determined choices?

A

<select>

28
Q

What occurs when users must submit and resubmit a form until it validates?

A

pogo-sticking

29
Q

Which input type displays as rectangle field into which users can type alphanumeric characters of their choice?

A

<input type=”text”>

30
Q

Which input type allows the user to choose colors?

A

<input type=”color”>

31
Q

Which input type allows the user to enter a date (without time zone) using a drop-down date-picker calendar?

A

<input type=”date”>

32
Q

Which input type allows the user to choose a date and time with a GMT time zone?

A

<input type=”datetime”>

33
Q

Which input type allows the user to choose a date and time with a local time zone?

A

<input type=”datetime-local”>

34
Q

Which input type allows the user to enter an e-mail address?

A

<input type=”email”>

35
Q

Which input type allows the user to choose a date using the month and year (without time zone)?

A

<input type=”month”>

36
Q

Which input type allows the user to enter rational integers or float values?

A

<input type=”number”>

37
Q

Which input type allows the user to enter numbers using a slider control?

A

<input type=”range”>

38
Q

Which input type allows the user to enter text for a search query?

A

<input type=”search”>

39
Q

Which input type allows the user to enter a phone number?

A

<input type=”tel”>

40
Q

Which input type allows the user to enter a time (without time zone)?

A

<input type=”time”>

41
Q

Which input type allows the user to enter a URL, such as an http://, ftp:// or mailto: address?

A

<input type=”url”>

42
Q

Which input type allows the user to choose a date using the week and year (without time zone)?

A

<input type=”week”>

43
Q

Which element specifies a list of pre-defined choices for an <input></input> element?

A

<datalist>

44
Q

Which element adds security to a form through asymmetric encryption by creating a key-pair generator field in the form?

A

<keygen>

45
Q

Which element displays the result when a calculation is performed?

A

<output>

46
Q

Which attribute applies focus on the element when the page loads?

A

autofocus

EXAMPLE: <input type=”text” autofocus>

47
Q

Which attribute disables an element?

A

disabled

EXAMPLE: <input type=”text” disabled>

48
Q

Which attribute specifies the IDs of elements whose values were used?

A

for

EXAMPLE: <label for=”other”>Other</label>

49
Q

Which attribute specifies the form(s) on the page in which the element appears?

A

form

EXAMPLE: <button type=”submit” form=”form1”>Submit</button>

50
Q

Which attribute specifies a name for the element that can be used to reference it?

A

name

EXAMPLE: <input type=”text” name=”fname”>

51
Q

Which attribute specifies whether text submitted in a form field is to be wrapped?

A

wrap

EXAMPLE: <textarea rows=”2” cols=”20” wrap=”hard”>At W3Schools you will find free Web-building tutorials.</textarea>

52
Q

Which element allows you to add a caption for a group of items created by the <fieldset> element?

A

<legend>

53
Q

Which element is used to group elements so that related fields are placed together in a form?

A

<fieldset>

54
Q

Which element enables you to add a label to an input element in a form?

A

<label>

55
Q

When you use the <input></input> element to create form fields, what occurs if you neglect to include the type attribute?

A

The browser will use the default type of text.

56
Q

What occurs if an input type is not supported by a browser (example: search)?

A

The browser will degrade to a standard text box.

57
Q

What is a disadvantage of waiting to validate user input until after the user completes the form?

A

Some users may become frustrated if they need to submit and resubmit a form until it validates.

58
Q

What is the benefit of inline validation?

A

Users can resolve errors as they fill out each form field and submit the completed form just once.

59
Q

What can validation techniques not check for?

A

truthful information

60
Q

This JavaScript code is the equivalent of which HTML5 attribute?

function validateForm(){
var x = document.forms[“myForm”][“number”].value;
if (!x){alert(“Please enter a phone number”);
return false;}
}

A

The ‘required’ attribute

61
Q

This JavaScript code is the equivalent of which HTML5 attribute?

function validateForm(){
var x = document.forms[“myForm”][“email”].value;
var atpos=x.indexOf(“@”);
var dotpos=x.lastIndexOf(“.”);
if (atpos < 1 || dotpos < atpos+2 || dotpos + 2 >= x.length){
alert(“Please enter a valid e-mail address”);
return false;}
}

A

The ‘pattern’ attribute

62
Q

Calculations in a Web page form are usually performed by what?

A

a script

63
Q

Do HTML5 input types display differently or the same in various browsers?

A

differently

64
Q

What is the default security algorithm used with the HTML5 <keygen></keygen> element?

A

RSA

65
Q

What two keys are created by the HTML5 <keygen></keygen> element?

A

A private key and a public key

66
Q

Prior to HTML5, what did Web developers use to conduct inline validation in HTML forms?

A

JavaScript