How do configure Zend_Form to use array notation?

后端 未结 2 958
情话喂你
情话喂你 2021-01-03 07:34

I\'m having difficulty configuring Zend_Form. I have a Zend_Form sub-class. The form has some required information and some additional information. I want the additional inf

相关标签:
2条回答
  • 2021-01-03 08:01

    Sorted it! The problem is a custom decorator that was being used.

    //In
    $subForm = new Form_SubForm(); //this can be a Zend_Form or Zend_Form_SubForm     
    $subForm->setIsArray(true);
    $this->addSubForm($subForm, 'subform');
    

    Elements will be rendered with a id of subform-elementname and a name of subform[elementname].

    0 讨论(0)
  • 2021-01-03 08:15

    To expand on the answer because $form->setIsArray(TRUE) was not working with my custom decorator for elements. My custom ViewScript decorator was needed for rendering the Zend_Form_Element.

    The problem, it was rendering the element name with $this->element->getName(). I had to use $this->element->getFullyQualifiedName() in the ViewScript decorator script.

    0 讨论(0)
提交回复
热议问题