Let??™s look at the markup of each of the areas of this form in
turn; each section is divided by a thin rule in the screenshot.
In the markup, each section is contained in a div with the class
formsection.
The ?¬? rst formsection div doesn??™t contain form elements, but a list.
This list can be used to display instructions to the user, but its primary
purpose is to display errors. As in Figure 6.13, this list is usually
hidden (its display property is set to none). The server-side code
(e.g., PHP) would add a customized version of this list, adding the
class that makes it appear and the list items with error messages,
into the page before re-presenting the page to the user so he can
understand and correct the problems, and resubmit the form.
So even if you are not personally writing server-side code, you can
set up the XHTML and CSS for a form so it is capable of displaying
error messages and then work with the site??™s technical team
to ensure that the server-side code adds the appropriate text and
classes into the code to display errors as you intended.
Now let??™s look at the markup of the previous form in detail.
THE FORM ELEMENT
Every form is enclosed in a form element.
Pages:
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231