특수한 데코레이터가있는 일반 양식이나 일부 데코레이터가 제거 된 경우에는 하위 폼이 필요하지 않습니다.
<?php
class Your_Form_Example extends Zend_Form
{
public function init() {
// wrap the select tag in a <span> tag, hide label, errors, and description
$selectDecorators = array(
'ViewHelper',
array('HtmlTag', array('tag' => 'span'))
);
$this->addElement('select', 'danny', array(
'required' => true,
'multiOptions' => array('opt1', 'opt2'),
'decorators' => $selectDecorators // use the reduced decorators given above
));
}
}
가 여기에
<form method="<?php echo $form->getMethod() ?>" action="<?php echo $form->getAction() ?>">
<p>Danny had <?php echo $form->danny ?> apples and James had <?php echo $form->james ?> pears.</p>
<p>More stuff here...</p>
<?php echo $form->submit ?>
</form>
이 좋은 형태로 출력을 유지하기 위해
<p>Danny had <span><select name="danny" id="danny"><option>opt1</option><option>opt2</option></select></span> apples and James had .....</p>
같은 결과한다 ... 양식을 렌더링하는보기 스크립트의 오류, 설명 및 레이블 데코레이터가 제거되어 렌더링되지 않습니다. 따라서 양식의 오류를 검사 할 때 select 요소와 함께 렌더링되지 않으므로 select 요소에 오류가있는 경우 양식 상단 또는 다른 곳에 표시해야합니다.
희망이 있습니다.