php-如何将id属性添加到Zend Framework表单?
作者:互联网
我有一个简单的类,它用2个元素扩展了Zend_Form:
class Application_Form_Player extends Zend_Form
{
public function init()
{
$this->addElement('text', 'firstName', array(
'label' => $this->getView()->translate('First name') . ' (' . $this->getView()->translate('imaginary') . ')',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(array('StringLength', false, array(1, 256)))
)
);
$this->addElement('text', 'lastName', array(
'label' => $this->getView()->translate('Last name') . ' (' . $this->getView()->translate('imaginary') . ')',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(array('StringLength', false, array(1, 256)))
)
);
}
}
是否可以使用Zend_Form方法将“ id”属性添加到此类创建的HTML“ dl”中?
这就是要向其添加id属性的HTML dl:
<dl class="zend_form">
...
</dl>
解决方法:
$this-> setAttrib(‘id’,’someId’);,这将帮助您$this是当前类的对象.
标签:zend-form,zend-framework,php 来源: https://codeday.me/bug/20191028/1952669.html