Validating form fields using javascript

Posted by / 05-Nov-2017 09:46

Validating form fields using javascript

Once you create the User Profile table make sure to add an ADO.NET Entity Data Model to the project so that you get the User Profile entity class as shown above.In the above example, the [Range] attribute checks whether the Age is between 18 and 100.The [Url] attribute checks whether a property value is a valid URL.The [Email Address] attribute validates a property for a valid email address.

If you don't specify any Error Message, a default error message is displayed.The [String Length] attribute is used to specify the maximum length and optionally the minimum length for a property value.For example, the [String Length] attribute used on the First Name property specifies the maximum length for First Name to be 50 and Minimum Length to be 3.If an error message is not specified, a default error message is displayed.Now that you have some idea about data annotation attributes, let's develop a simple ASP.

validating form fields using javascript-81validating form fields using javascript-40validating form fields using javascript-41

This friendly name is used by HTML helpers such as Html. If you don't use the [Display Name] attribute a property name will be used for display purpose.