Chapter 6Validating Your Data

Form validation is especially important when using that form data for visualization. That's because malformed data can quickly derail a chart or table. For instance, if your chart shows aggregated data across different dates, this data formatting had better be consistent. If one user enters February 4, 1986 and the other enters 2-4-86, you had better figure out some way to align these values before displaying them. In general, the easiest way to do this is to validate the data before you ever store it.

In this chapter you explore the differences between server-side and client-side validation and then discover a variety of client-side techniques. You first look at native HTML5 validation approaches. Those leverage semantic tags to validate fields against various data types and validation rules.

Next, you learn about jQuery Validation Engine, which provides more feature-rich validation. You learn how to use its basic regex validators, as well as more complex rules for numbers and dates. Then you see how to set up intricate relationships between the various fields in your form.

By the end of this chapter, you'll ...

Get JavaScript and jQuery for Data Analysis and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.