Zend HTML5表单元素类型 [英] Zend HTML5 Form element types
问题描述
有没有简单的方法将HTML5表单元素转换为Zend表单?的createElement(电话,电话);只是不起作用,因为zend不支持html5表单元素,但似乎......你不能在创建后覆盖type属性。
Is there any easy way to get HTML5 Form elements into a Zend Form? createElement('tel','phone'); just doesn't work because zend doesn't support html5 form elements yet it seems... you can't override the type attribute either after it's been created.
E.G。我的zend表格需要输入type =tel / email / date / number等。
E.G. I need input type="tel/email/date/number" etc on my zend form.
推荐答案
没关系,我发现这个文章: http://www.enrise.com/2010/ 12 / HTML5-Zend的框架外形元件/ 。我只需要将他的代码复制到我的MVC架构中,现在就可以了。除了我必须在Number.php中放置$ this-> setAttrib('type','number')之外,因为除非它在控制器中设置,否则它不会添加该选项,因为我创建它有点愚蠢一个新的Glitch_Form_Element_Text_Number或任何o_O。
Nevermind, I found this article: http://www.enrise.com/2010/12/html5-zend-framework-form-elements/. I just had to copy his code into my MVC architecture and it works now. Except I had to put $this->setAttrib('type','number') for example in Number.php, because it doesn't add the option unless its set in the controller, which is a bit stupid because I was creating a new Glitch_Form_Element_Text_Number or whatever o_O.
这篇关于Zend HTML5表单元素类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!