allow HTML5 form input elements by jimgregory · Pull Request #440 · webpy/webpy
HTML5 now allows for 13 additional elements from the original HTML4 spec, like 'email', 'tel', 'date', etc. All modern browsers support them, and they give a better user experience with intuitive widgets and basic client-side error checking.
Each new input type is defined by declaring a type attribute on an input element, e.g. <input name="foo" type="date"/>. Rather than creating specific classes for all 13 of them, which would be difficult to remember and greatly expand the code base, I propose modifying the generic Input element so it allows a type element to be passed as an input to the class; i.e. web.form.Input(name="foo", type="date"). This will prevent having to update form.py in the future if/when other new input types are added.
I did not include any check to see if the type is a valid HTML5 form type. I can include a list of valid types to check against, but this would again become invalid if/when the set of valid HTML5 input types is extended.