Zend Framework 2 Forms Array notation for drop dow

2020-08-04 09:59发布

I am using Zend Framework 2 Forms using array notion for a select (drop down box). Code snippet from MenuForm.php is below:

 $options_for_select = $menuTable->GetParents();
    $this->add(array(
        'type' => 'Zend\Form\Element\Select',
        'name' => 'parent',
        'attributes' => array(
            'options' => $options_for_select,
        ),
        'options' => array(
            'label' => 'Select parent item',
            ),
        )
    );

When this drop down changes I would like to populate another drop down list on the form with a list of options that are related to the item selected in the parent drop down list.

How can I achieve this?

Thank you.

0条回答
登录 后发表回答