Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Voices That Matter

This chapter is from the book

This chapter is from the book

G: The example scripts

After all this theory, it’s time to study the usability and accessibility of the example scripts.

Six out of eight example scripts offer significant usability enhancements over the unscripted page, and are therefore, I think, worthwhile to use. We’ll treat the remaining two, Dropdown Menus and Site Survey, in due time, and you’ll have to form your own opinion about their usability or lack thereof.

Seven out of eight example scripts are accessible, and the remaining one, Edit Style Sheets, doesn’t have to be. Unfortunately, I made a few minor mistakes in Sandwich Picker that cause usability problems in the accessible noscript version. I could have removed them while preparing the script for this book, but decided not to because they highlight a few interesting accessibility solutions.

Textarea Maxlength

When the user exceeds the 1250-character maximum length, the counter warns him. In addition, he can see how many characters he’s already typed. This is a small usability benefit.

Figure 2.6 Textarea Maxlength with script enabled. The counter gives a warning when the user exceeds the maximum length.

If the script doesn’t work, it doesn’t warn the user. However, right next to the text area there is a text that states the 1250-character maximum length. In theory, a noscript user still has sufficient information. (In practice, users don’t read such texts. That’s not my problem, though. I’ve done what I needed to do to make the page accessible.)

Also, I generate the counter by JavaScript, since it would be confusing in the noscript version.

Figure 2.7 Textarea Maxlength noscript. The counter is gone, but the user doesn’t know it’s supposed to be there.

Usable Forms

From a usability perspective, it’s a good idea to hide as many form fields as possible until the user indicates she needs them.

Figure 2.8 Usable Forms with script enabled. The user sees a short form.

If the script doesn’t work, the user sees the complete form with all fields. That’s less usable than the scripted version, but still accessible. In addition, the form creator is allowed to add extra elements with class=”accessibility” to the form. These elements are meant for noscript users and should contain useful help texts. If the script runs, it automatically generates an extra style:

.accessibility {display: none}

Figure 2.9 Usable Forms noscript. The user sees all form fields. Fortunately, many form fields have an extra help text, which is a must in this confused jumble.

This style hides the extra elements when the script works.

Form Validation

Validating a form is the oldest JavaScript effect in existence. Thus it’s quite likely that a user has encountered it before. As we saw in 1A, this script saves the user a round-trip to the server if she makes a mistake. From a usability perspective that’s always good. Then, the error messages are displayed right next to the form fields they apply to, which makes the whole process clear.

If the script doesn’t work, the form is not validated. The only solution to this problem is installing a server-side form-validation script. This solution has been general knowledge since the dawn of time, but has always been disregarded.

The form fields contain attributes that define which validations the script should perform on them. The server-side script could use these same definitions.

Dropdown Menu

Are dropdown menus good from a usability point of view? I’m not going to get mixed up in that discussion; I will restrict myself to the observation that they’re a golden oldie for which clients frequently ask. Besides, most Web surfers are used, or at least resigned, to them.

Figure 2.10 Dropdown Menu with script enabled. Does it make the navigation more usable?

Dropdown Menus offers an extreme example of diminished usability without JavaScript. I carefully crafted the CSS so that the menus would continue to be as user-friendly as possible in the absence of JavaScript, but in the end they remain huge lists of links that are hard to search through. Technically they are accessible—any user can activate any link—but finding the link you want to activate is another story altogether.

Figure 2.11 Dropdown Menu noscript. All menus are permanently folded out. Not much usability, but accessibility is preserved.

Edit Style Sheets

This example script isn’t meant for the average user. It’s a site-administration script for Web masters; therefore, accessibility is not an issue. It’s perfectly acceptable to say that all Web masters must use Explorer or Mozilla with JavaScript enabled in order to use the page.

As to usability, it’s excellently suited for allowing people who don’t know anything about CSS to edit a style sheet. They immediately see the result of their actions, and that’s what counts.

Sandwich Picker

From a usability perspective, I consider Sandwich Picker the best script in this book. It’s a simple, obvious way of quickly searching through a lot of items (and remember that the page I created for my client held about three times as many sandwiches as the example page I put on my site). Although it was born from necessity—the client didn’t have the money for a database-driven solution—I feel that Sandwich Picker can also be used in database-driven search sites to fine-tune the results.

Unfortunately, I made a few errors on the page. Strictly speaking, it is accessible because the user can submit the form and thus order sandwiches—as long as he enters the sandwich names in the text area. Nonetheless, the usability of this noscript version suffers from a few problems.

First, I included a message for noscript users that offered an extra mailto link to get in touch with the site owner. It’s correctly implemented: I hard-coded the message in HTML and then hid it by JavaScript, so that it is visible only if JavaScript is not supported. However, since the user can submit the form, this extra message was not really necessary and could confuse noscript users: “Do I use the mail link or the form?”

The second mistake is that I plain forgot to include <label> tags, which are a must for any accessible form.

The third mistake is even more insidious: I coded the form fields next to the sandwich names in exactly the wrong way. I had two other options, either of which would have resulted in better usability for the noscript page, but I chose the worst solution.

The HTML of one sandwich <tr> looks like this:

<tr>
	<td class=”number”><input /></td>
	<td class=”description”>English sandwich</td>
	<td class=”extra”>bacon, cheese, lettuce, tomato</td>
	<td class=”empty”>freshly fried</td>
</tr>

Note that the <input> tag lacks all attributes. I did this deliberately, to keep the page easy to maintain. My client knew some basic HTML, and I trusted him to add a <tr> with new text for every sandwich to the document. However, I decided not to bother him with creating a unique name attribute for every <input>. Instead, I generated the necessary name by JavaScript.

When the page is loaded, these <input> tags are not part of the <form>. When the user indicates she wants to order a certain sandwich, the <tr> is moved to the order table, and only this table is part of the form.

<form method=post action=”/cgi-bin/formmail/formmail.pl”>
<table class=”search”>
	<tbody id=”ordered”>
	<tr>
		<td colspan=”3”><h3>Your order<h3></td>
		<td class=”extra” rowspan=”200”>
			<div id=”orderForm”>
			// name and phone fields
			</div>
		</td>
	</tr>
	// <tr>s of ordered sandwiches
	// are inserted here
	</tbody>
</table>
</form>

I did this because I wanted to send the server only those form fields that actually contain a value, i.e., only the sandwiches that the user really ordered.

It works fine in the scripted version. In the noscript version, though, users may think they can simply enter the desired number of sandwiches in the fields and submit the entire form. But the sandwich inputs are never sent to the server because they’re not part of the form. Even if they were, they don’t have a name, so my client would never know which sandwich the user has ordered.

This is clearly an error on my part. I could have solved it in two ways:

  1. I could have hard-coded the form-field names and extended the <form> tag to cover the entire page. Disadvantage: all empty form fields would be sent to the server, too. Besides, my client would have to remember to create a new name attribute for every new sandwich he inserted.
  2. I could have generated the <input /> tags by JavaScript. Disadvantage: none, really. Noscript users don’t see any form fields in the sandwich table, but they don’t know the fields are supposed to be there and will treat the table as a list of available sandwiches.

In retrospect, I should have generated the <input /> tags.

XMLHTTP Speed Meter

This script is usable enough, even though I’d be the first one to admit that both the XMLHTTP call and the animation have mainly been added for the wow-effect, not to combat serious usability problems. It’s perfectly possible to create a simple form, submit it to the server, and receive a page that shows the download speed.

In fact, the noscript version does exactly that. The database programmer created two PHP scripts: one to create XML for the scripted version, and one to create HTML for the noscript version.

Figure 2.12 XMLHTTP Speed Meter noscript.

The only visible difference between the scripted and noscript versions is the Submit button. Note how it’s being shown and hidden:

  • The HTML contains a hard-coded <input type=”image”> that will work anywhere. It submits the form to the HTML-generating PHP.
  • When JavaScript is supported, the input is hidden. The script also revises the form’s action attribute so that it points to the XML-generating PHP.

Site Survey

People (especially Web developers) hate popups. Since Site Survey hinges on the clever use of a popup, some will question its usability. I knew that when I created the script, and the client and I quickly agreed on a few measures to maintain at least a semblance of user-friendliness:

  • The popup would contain a short text that explained that a survey was in progress, and would they please leave the popup open. Thus it would at least be clear why the popup was present.
  • The user would be allowed to close the popup at any time. The script would interpret this as a sign that the user did not want to participate in the survey. In addition to being user-friendly, this was also a coder-friendly decision: when the popup closes, do nothing.

As to accessibility, the popup won’t open when JavaScript is disabled, and hence the script that follows the user in his journeys through the surveyed site won’t work, either. Since the survey is not a necessary ingredient of any site, its demise is no problem; the host sites remain as accessible (or inaccessible) as they were.

The only accessibility problem is that noscript users are effectively barred from participating in the survey. Since they might conceivably use the survey to complain about the host site’s inaccessibility, I offered them one loophole to enter it. The host site’s homepage contains (or rather, is supposed to contain) a line of text with a link that leads directly to the survey. If the script kicks in, it is replaced by a text that warns that a popup is about to be opened.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020