HTML 5 Validation scripts in ASP.NET MVC

With the arrival of HTML5, you can make use of the cool new form validation features like:

  • email, url
  • number
  • required

Problem with these features, for me, is that each browser uses their own notifications. I prefer that I can use a notification that looks the same in all browsers.

One way to do this is with Javascript and CSS, more info can be found on several sites. Here is an example page that microsoft created: click here.

If you don’t want that the browser validates your form, you can use the novalidate keyword on the form. If you are using ASP.NET MVC you can pass this attribute like so:

@using (Html.BeginForm(null, null, FormMethod.Post,new {novalidate="true"}))

Hope this one helps you in you projects

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: