(And if you don??™t care, why collect it?)
Although validation needs to happen on the server, it??™s good for users and for the feel and
usability of your applications to have JavaScript-enhanced validation.
With a little extra work and help from a library or two, you can have your server-side validation
also take place in the user??™s browser without having to duplicate all your validation
functions in JavaScript.
May all your data gathering be valid from now on!
CHAPTER 7 n FORM VALIDATION AND JAVASCRIPT 165
Case Study: FAQ Facelift
By Aaron Gustafson
In the history of the Internet, there have been few things as constant as Frequently Asked
Questions (FAQ) pages. Nearly every site has one, either in name or in spirit, and these pages
really haven??™t changed much since they first appeared in the early 1990s.
Most FAQs take the form of a list of questions in which each is a link (using either an id
or a name reference) to the applicable question/answer pair somewhere further down on the
page, as seen in Figure 8-1. Maintenance of these FAQs can quickly become a nightmare
because editors must not only create the question/answer pair but also then update the list
at the top of the page (or on another page altogether). DRY principle be damned.
nNote DRY: Don??™t Repeat Yourself.
Over the years, many of us have searched for a better way to manage FAQs, if only to
make our lives a little easier.
Pages:
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241