I’m working on a site that would benefit from using HTML5 input fields (email validation, phone numbers etc) and was wondering if anyone’s had the opportunitiy to code an extension to CHTML class to include HTML5 elements.
I noticed there’s been a ticket about this for nearly 2 years:
Nope. Haven’t thought of it yet. But this would be a good start. You should take into strong consideration that those HTML5 elements won’t work in most browsers being used (still tons of users use IE, and not Chrome or FF users have updated their browsers).
I have a quick fix that allows me to use CHTML to draw custom fields. I’ve modified “/framework/web/helpers/chtml.php”, and modified line 1106 (from Yii 1.1.8) and modified the following code from:
protected static function inputField($type,$name,$value,$htmlOptions)
… to …
public static function inputField($type,$name,$value,$htmlOptions)
This allows you to call this function directly, like so: