嗨,我有一个包含此代码的 zend 表单
$field = new Zend_Form_Element_Submit('submit');
$field->setAttrib('class', 'btn')->setlabel('Save');
$this->addElement($field);
但HTML的到来是:
<input type="submit" class="btn" helper="formSubmit" value="" id="submit" name="submit">
无法弄清楚为什么值没有显示?
$field->setAttrib('class', 'btn')->setLabel('Save');
请注意上面setLabel()
的大写字母"L"
将类型(默认类型="按钮"不触发表单提交)更改为"提交"。
例如$this->addElement('button', 'my_button', array(
'label' => 'Click me',
'class' => 'nice_button',
'type' => 'submit'
));
您要设置值吗? 所以使用二传手: $field->setValue('Save');