For example, imagine this model type:
public class MyModel
{
public int ID { get; set; }
[DataType(DataType.Url)]
public string WebSite { get; set; }
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
}
In MVC3 it gets rendered roughly like this (with everything set to type="text):
ID: <input type=”text” name=”ID” value=”123” />
WebSite: <input type=”text” name=”WebSite” value=”http://example.com/path/file.html” />
Email: <input type=”text” name=”Email” value=”eilon@example.com” />
In MVC4 it should render more appropriate "type" attributes:
ID: <input type=”number” name=”ID” value=”123” />
WebSite: <input type=”url” name=”WebSite” value=”http://example.com/path/file.html” />
Email: <input type=”email” name=”Email” value=”eilon@example.com” />
We need to do this automatically for tel, url, email, datetime, date, time, and number.
Comments: Fixed in changeset 68a34436db0c25068b2d437f72ca59ac67239b27
public class MyModel
{
public int ID { get; set; }
[DataType(DataType.Url)]
public string WebSite { get; set; }
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
}
In MVC3 it gets rendered roughly like this (with everything set to type="text):
ID: <input type=”text” name=”ID” value=”123” />
WebSite: <input type=”text” name=”WebSite” value=”http://example.com/path/file.html” />
Email: <input type=”text” name=”Email” value=”eilon@example.com” />
In MVC4 it should render more appropriate "type" attributes:
ID: <input type=”number” name=”ID” value=”123” />
WebSite: <input type=”url” name=”WebSite” value=”http://example.com/path/file.html” />
Email: <input type=”email” name=”Email” value=”eilon@example.com” />
We need to do this automatically for tel, url, email, datetime, date, time, and number.
Comments: Fixed in changeset 68a34436db0c25068b2d437f72ca59ac67239b27