Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use HTML5 email input type with server-side .NET

Tags:

As I understand it, the <input type=email> element in HTML5 will render as a simple text field in browsers that do not support the tag. On other browsers it will render properly, like on the iPhone it will bring up the e-mail keyboard layout.

I’d like to use this in a project but my input fields are <asp:TextBox> controls. How can I use the HTML5 element but still access its data server-side like the rest of my fields?

like image 616
Michael Avatar asked Jul 12 '10 20:07

Michael


People also ask

How many email addresses enter HTML5 URL input type at once?

Its size and maxlength attributes are both set to 64 in order to show room for 64 characters worth of e-mail address, and to limit the number of characters actually entered to a maximum of 64. The required attribute is specified, making it mandatory that a valid e-mail address be provided.

Which is the correct syntax for email validation in HTML5?

The <input type="email"> defines a field for an e-mail address. The input value is automatically validated to ensure it is a properly formatted e-mail address. To define an e-mail field that allows multiple e-mail addresses, add the "multiple" attribute.

What are the new input types for form validation in HTML5?

HTML 5 introduces several input types like Date, DateTime-local, time, week, month, email, tel, URL, search, range, color and number. To improve the user experience and to make the forms more interactive. However, if a browser failed to recognize these new input types, it will treat them like a normal text box.


1 Answers

There is an update for .NET framework 4 which allows you to specify the type attribute

http://support.microsoft.com/kb/2468871.

See feature 3 way down the page

Feature 3

New syntax lets you define a TextBox control that is HTML5 compatible. For example, the following code defines a TextBox control that is HTML5 compatible:

<asp:TextBox runat="server" type="some-HTML5-type" /> 
like image 160
Chris Diver Avatar answered Oct 18 '22 21:10

Chris Diver