0
zendForms를 사용하고 있으며, 양식 필드를 그룹으로 그룹화하고 프론트 엔드에서 여러 div에 표시하고 싶습니다. 또한 저장 작업을 동일하게하고 싶습니다. 버튼이 가능한가?젠드 양식 필드 그룹화
zendForms를 사용하고 있으며, 양식 필드를 그룹으로 그룹화하고 프론트 엔드에서 여러 div에 표시하고 싶습니다. 또한 저장 작업을 동일하게하고 싶습니다. 버튼이 가능한가?젠드 양식 필드 그룹화
일반적으로 ZF를 사용하면 여러 가지 방법을 사용할 수 있습니다. 가장 쉬운 방법은 표시 그룹을 정의하고 기본 html이 필요한 것인지 확인하는 것입니다 (디스플레이 그룹은 기본적으로 fieldset
태그로 렌더링됩니다). 더 많은 사용자 정의가 필요하면
, 아래 참조 :
class Form_Product extends Zend_Form
{
public function init()
{
$a = new Zend_Form_Element_Text('a');
$b = new Zend_Form_Element_Text('b');
$c = new Zend_Form_Element_Text('c');
/*
* The first way is to define display groups and customize their decorators
*/
$this->addDisplayGroup(array($a, $b), 'groupAB');
$this->getDisplayGroup('groupAB')->setDisableLoadDefaultDecorators(true);
$this->getDisplayGroup('groupAB')->setDecorators(array(
'FormElements',
'DtDdWrapper'
)); // or whatever decorators you need
$this->addDisplayGroup(array($c), 'groupC');
// ...
/*
* Second way is to use custom view script to render the form.
* In view use $this->element to get form object
* and $this->element->getElements() or $this->element->getElement('name') to get elements
*/
$this->addElements(array($a, $b, $c));
$this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'controller/action/form.phtml')),
));
}
}