Wednesday, January 26, 2011

Using HTML5 Input types with Spring 3.0 form tags

HTML5 supports various input types including email, url and tel. There is a lack of documentation for using these new types with the Spring form taglib. After trial and error I tried:
<form:input type="tel" alt="Home Phone" path="homePhone"/>
which surpisingly enough produced the expected code:
<input type="tel" alt="Home Phone" value="" name="homePhone" id="homePhone">
It is nice when something follows the principle of least astonishment.