A Basic Approach to Server-side Data Validation with AJAX
Would you like to learn how to validate user-supplied data using JavaScript, but without the risks? This article will show you how to handle it in a way that takes advantage of JavaScript's pluses, but adds a level of safety, thanks to AJAX. It is the first of three parts.
A Basic Approach to Server-side Data Validation with AJAX - Spicing up the sample form: defining a few CSS declarations (Page 4 of 5 )
As I mentioned in the previous section, the next thing I have to do is define a few CSS declarations to polish the look and feel of the online form, as well as the remaining elements of the web document. There's no need to mention that you can code your own CSS styles and give the web page a completely different presentation; as you know, here I'm exposing only an example, thus feel free to write the CSS styles that best suit your personal needs.
Okay, having defined the structural markup of the AJAX applications, here is the full list of styles that I'll attach to the web page's elements:
If you examine the above CSS declarations, then you'll see that they're extremely simple. Basically, I styled the respective form boxes and the submitting button, while the remaining selectors are responsible for styling the containing DIVs that wrap up the online form and the area for displaying error messages. That's about it.
All right, since the above CSS rules bear not much discussion due to their simplicity, feel free to jump straight into the upcoming section, where I'll be showing you the full (X)HTML markup code of this small AJAX application, along with the CSS rules that you saw before.