Validating web form
Therefore, you also have to make sure that the values that users enter can be correctly converted to the appropriate data types.
You might also have certain restrictions on the values.
If a form is long or complex, reporting errors only after the page is submitted can be inconvenient to the user.
You can add support to perform validation in client script.
However, the test will be performed in server code.
You can control how validation errors are displayed by defining CSS classes that have the following reserved names: .
Client-based validation can also reduce the number of times that the user has to submit the form to correct multiple errors.
A disadvantage of this approach is that users don't know that they've made an error until after they submit the page.The CSS rules that end in to both have the same fixed size.That way, the display area for the field is static and won't change the page flow if an error message is displayed.These pairs let you define rules for both conditions: an error condition and a "normal" (non-error) condition.It's important to understand that the markup for the error display is always rendered, even if there are no errors.