Tutorial 07: Designing a Web Form
The _____ attribute must be added to the control to identify whether the data has been supplied to those fields that are opposed to the ones that are optional.
required
HTML supports the _____ attributes to set the text area size.
rows and cols
Identify the type of control that performs an action.
A form button
Used for selecting data values limited to two possibilities, such as "yes" or "no"
Check boxes
In the accompanying figure, what does Box A represent?
Input box
Used for text and numerical entries
Input boxes
Used for a long sequence of options
Selection lists
Identify a widget that allows the user to interact with the form for entering numeric values confined to a specified range.
Slider control
A _____ is a control used to enter text strings that may include several lines of content.
Text area box
Command buttons are created using the input element with the type attribute set to _____.
button
Used to append the form data to the end of the URL
get
Used to create an email field that is part of the form but not displayed
hidden
The process of ensuring that the user has supplied correct data is called _____.
validation
Which of the following is true of field sets?
Field sets act like block elements that can expand to accommodate their content.
_________ refers to the state in which an element has been clicked by the user, making it the active control on the form.
Focus
Processes the form when clicked
Form buttons
Used to group items on a drop-down list
Option groups
A default value need not be specified; the text area box can be left empty or the placeholder attribute can be used to provide a hint to users about what to enter into the text box.
True
Once the field values have been entered by the user, they are processed by a program running on the user's computer or on a web server in a secure location.
True
Identify a syntax used to create a spinner control using an input element. a. <input name="name" id="id" type="number" value="value" step="value" min="value" max="value" /> b. <input name="name" id="id" type="number" value="value" set="value" min="value" max="value" /> c. <input name="name" id="id" type="number" value="value" size="value" min="value" max="value" /> d. <input name="name" id="id" type="number" value="value" area="value" min="value" max="value" />
a
The ____ element is used to create a custom option.
button
Which of the following can Oscar use to display a list of makes and models of skateboards? a. Text area boxes b. Radio buttons c. Selection lists d. Slider controls
c
A form contains _____, also called widgets, which are the objects that allow the user to interact with the form.
controls
By default, browsers display input boxes as _____ elements with a default length of 20 characters.
inline
The technique of immediate data validation and reporting of errors is known as _____.
inline validation
The _____ element is used to mark the form controls that are designed to receive user responses.
input
To associate a text string entered above each input element with a control, the text string should be enclosed within the _____ element.
label
Every field set must contain the _____ element, which should have only text and no nested elements for describing its content.
legend
The _________ attribute is added to the input element to apply a data list.
list, <input list="id"/>
The _________ element is an HTML element used to access and run JavaScript programs that will run within the user's browser.
script
A(n) _____ is created using the select and option elements that present users with a group of predefined possible values for the data field.
selection list
Which of the following is true of nesting a control within a label?
It allows the user to move both the label text and the control as a single unit around the page.
Identify the significance of "text" in <form id="text">.
It identifies the form.
Created with a group of input elements with a type attribute value of radio, sharing a common data field name
Option buttons
_____ are text strings that appear within a form control, providing a hint about the kind of data that should be entered into the field.
Placeholders
_________ are text strings that appear within a form control, providing a hint about the kind of data that should be entered into the field.
Placeholders
A spinner control can be used to limit a numeric field to a range of possible values, thus allowing the user to drag a marker horizontally across the possible field values.
False - slider control
Oscar's skateboards are manufactured in different hues. Which of the following features should Oscar add to allow customers to choose a shade of their choice?
Color pickers
Identify a list which when applied to an input box, the values appear as a pop-up list of suggested values.
Data list
A form element must be placed only within the header tag of a web page.
False
By default, legends are placed in the top-right corner of the field set box.
False
For url type data, the virtual keyboard includes a key that inserts the .com character string.
False
The second option in a selection list is selected by default and therefore contains the field's default value.
False
There are predefined CSS styles to format the appearance of a placeholder.
False
Command buttons are created using an input element with the type attribute set to range.
False - button
The post method is the default method that tells the browser to append the form data to the end of the URL specified in the action attribute.
False - get method
Option buttons are also called selection lists as they select data values from a more extensive list of options.
False - radio buttons
_____ are like selection lists in which they limit fields to a set of possible values; but, unlike selection lists, the options appear as separate controls in the web form.
Radio buttons
Identify the widget that limits a numeric field to a range of possible values by allowing users to drag a marker horizontally across the possible field values.
Slider control
What are the pseudo-classes for valid and invalid data?
The valid and invalid pseudo-classes are used to format controls based on whether their field values pass a validation test or not. For example, the following style rule displays all the input elements containing invalid data with a light red background: In put: invalid { background-color: rgb (255, 232, 233); } On the other hand, the following style rule displays all the input elements containing valid data with a light green background: input: valid { background-color: rgb (220, 255, 220); } Both of these style rules set the background color whether the input element has the focus or not. Displaying a form full of input backgrounds with different background colors can be confusing and distracting to the user. As a result, it is better practice to highlight invalid field values only when those input controls have the focus, as shown in the following style rule that combines both the focus and invalid pseudo-classes: input:focus:invalid { background-color: rgb (255, 232, 233); }
Describe the types of layouts that are used to design a form.
To be effective, the layout of the form should aid the user in interpreting the form and navigating easily from one input control to the next. There are two general layouts, one in which the labels are placed directly above the input controls in a single column and the other in which the labels and controls are placed side by side in two columns. Usability studies have shown that a single column layout is more accessible because the labels are placed more closely to their input controls. However, for long forms involving many fields, a single column layout can be difficult to work with due to the extensive vertical space required. The width of an input box is set by adding the following size attribute to the input element in the HTML file as given below: size="chars" Here, chars is the width of the input box in characters. For example, the following input element sets the width of the input box for a field to two characters: <input id="state" size="2" type="text" />
What are the attributes that tell the browser how the form should interact with the web server?
To specify where to send the form data and how to send it, the following action, method, and enctype attributes are defined. <form action="url" method="type" enctype="type">content </form> Here, the action attribute provides the location of the web server program that processes the form; the method attribute specifies how the browser should send form data to the server; and the enctype attribute specifies how the form data should be encoded as it is sent to the server. The method attribute has two possible values: get and post. The default is the get method, which tells the browser to append the form data to the end of the URL specified in the action attribute. The post method sends the form data in its own separate data stream. The enctype attribute has three possible values in predefined formats for a specific purpose
Client-side validation takes place on the user's browser.
True
In a form element, attributes specify how the form should be processed by the browser.
True
The appearance of a command, submit, and reset button is determined by the browser.
True
The default behavior of the selection list is to allow only one selection from the list of options.
True
The id attribute is required only when it is needed to reference the control element.
True
The most common way of accepting user input is through a web form.
True
The placeholder automatically disappears as soon as a user selects the control and begins to enter a value.
True
There is no need to include a for attribute within a label element while nesting a control, if the association is made implicitly.
True
When for attribute is used, the label text can be placed anywhere within the page and it will still be associated with the control.
True
Identify a syntax that displays a selection list as a scroll box with 5 options visible in the web form. a. <select size="5"> ... </select> b. <option size="5"> ... </option> c. <select value="5"> ... </select> d. <option value="5"> ... </option>
a
Identify a true statement of a JavaScript program in a web form. a. JavaScript intercepts the content of the form before the browser attempts to contact the CGI script and report whether the data contained in the survey form has been correctly filled out or not. b. JavaScript is a closed-source programming language, which provides tools and a programming environment for communicating the strategy and overall administration of distributed applications. c. JavaScript is extracted by all layout engines in a similar way; as a consequence, this grounds consistency in terms of functionality and interface. d. JavaScript is a bug-free Visual Basic scripting language, which is used only for networking applications.
a
Wyona wants to ensure that the text box should accept only 5 characters for entering a zip code. Which attribute of a text box will allow her to do this? a. maxlength b. size c. codevalue d. character
a
The default format in which the data is encoded as a long text string with spaces replaced by the + character and special characters replaced with their hexadecimal code values
application/x-www-form-urlencoded
Identify the cross-browser style sheet that changes the text color of the placeholder text for every input box to light red for the moz extension. a. input:-moz-input-placeholder {color: rgb (255, 151, 151);} b. input::-moz-placeholder {color: rgb(255, 151, 151);} c. input:-moz-placeholder {color: rgb (255, 151, 151);} d. input:: moz-placeholder-webkit {color: rgb(255, 151, 151);}
b
Identify a syntax of the option element that contains an attribute to make an option as default in a selection list. a. <option value="value" for>text</option> b. <option value="value" enctype>text</option> c. <option value="value" selected>text</option> d. <option value="value" default>text</option>
c
Identify a syntax that sets the data type of the registerDate field to "date". a. <label for="register">Date of registration</label> <input name="Date" id="register" /> b. <label for="register">Date of registration</label> <input name="registerDate" id="date" /> c. <label for="register">Date of registration</label> <input name="registerDate" id="register" type="date" /> d. <label for="register">Date of registration</label> <input name="registerDate" id="date" type="register" />
c
Oscar wants the web form to allow users to select the delivery date for the items he purchases. To select the dates, Oscar should use a _____.
check box
A check box can be selected automatically by adding the _________ attribute to the input element.
checked
A _________ is a button that runs a program, which affects the content of the page or the actions of the browser.
command button
Identify an attribute that can be added to the input element to validate a text value against a regular expression. a. legend="text" b. method="text" c. enctype="regex" d. pattern="regex"
d
Which type of field should Wyona provide for the user to provide plenty of space for customers to enter the information for a custom pattern? a. Input boxes b. Check boxes c. Spin boxes d. Text area boxes
d
A data entry control is associated with a _____ in which data values supplied by the user are stored.
data field
Specifies how the form data should be encoded as it is sent to the server
enctype
Grouping dozens of different fields into a _________ that a web form can have, makes the form easier to interpret and more accessible.
field set
Identify a pseudo-class for a check box or option button whose toggle states cannot be ascertained.
indeterminate
The check box control is created using the _____ element.
input
get and post are two possible values for the _____ attribute.
method
The format used when uploading files in which no encoding of the data values occurs
multipart/form-data
The _________ attribute is always needed in an input element while submitting the form to a server.
name
Identify the element that can organize selection list options by placing them in option groups in long selection lists.
optgroup
In the accompanying figure, Box B points to _____.
option buttons
Identify a data type applied in an input element to create slider controls.
range
By default, a _________ appears as a drop-down list box.
selection list
The process of validation that takes place on the web user is called _________.
server-side validation
In the accompanying figure, Box E represents a _____.
spin box
A _____ is used to restrict numeric values by displaying an up or down arrow to increase or decrease the field value by a set amount.
spinner control
The format in which data is transferred as plain text with spaces replaced with the + character, but no other encoding of the data values occurs
text/plain
If no _____ value is specified, the browser assumes a default value of text and adds a simple text input box to the web form.
type
Most mobile and tablet devices do not have physical keyboards; instead, they use _________ that exist as software representations of the physical device.
virtual keyboards