skip to content »

Validating web form controls using dhtml

validating web form controls using dhtml-42

The following table compares the information exposed on the page.In some instances, you might prefer not to use client-side validation and to use only server-side validation, even if client-side validation is available.

validating web form controls using dhtml-35validating web form controls using dhtml-76validating web form controls using dhtml-62

Also following the 80/20 rule, to cover the remaining use cases would require 80 percent of the effort (i.e.This enables you to determine validation status in server code and provides security against users bypassing client-side the same way on both the client and the server.Validation controls run a client-side script this makes them efficient because a network trip to the server is not necessary to validate data the client-side script is generated automatically at runtime.If the user is working with a browser that supports dynamic HTML (DHTML), ASP.For example, here's a typical example that uses an Error Provider (from the MSDN article "How to: Display Error Icons for Form Validation with the Windows Forms Error Provider Component"): event occurs when a control yields focus to another control.

So the event occurs when you use the tab key to move away from the current control or when you click another control with the mouse.

However, there are differences in the validation information exposed at the page level.

On the server, the page supports properties; on the client, it contains global variables.

For example, if you were describing the input, you might say, "It should be between five and eight characters; it should be numeric and non-negative; it should always end in the digit '5,' etc." The concept of considering the data qualities rather than the validation process leads to the validation engine discussed in this article.

A modular, data-driven validation engine approach provides a more natural interface, more flexibility, and is easier to maintain.

The second argument to Set Error is the message to display.