是否可以在视图中的Zend表单元素上使用setValue方法?我尝试这样做,但它给了我重复的字段...我的代码 :
<?php echo $this->form->str_bloc->renderViewHelper(); ?>
<?php echo $this->form->str_bloc->setValue(3); ?>
<?php echo $this->form->str_bloc->renderErrors(); ?>
有了这个,我有两个字段,一个是默认值,一个是用方法设置的值。当我删除第一行时,出现了nothig。
从设置值的行中删除"echo"并移动此行:
<?php $this->form->str_bloc->setValue(3); ?>
<?php echo $this->form->str_bloc->renderViewHelper(); ?>
<?php echo $this->form->str_bloc->renderErrors(); ?>