Zend Framework: Working with Form elements in array notation

前端 未结 4 1359
不知归路
不知归路 2020-12-10 11:59

I would like to be able to add a hidden form field using array notation to my form. I can do this with HTML like this:



        
4条回答
  •  忘掉有多难
    2020-12-10 12:07

    To use array notation, you need to specify that the element "belongs to" a parent array:

    $form->addElement('hidden', 'contact123', array('belongsTo' => 'contacts', 'value' => '123'));
    $form->addElement('hidden', 'contact456', array('belongsTo' => 'contacts', 'value' => '456'));
    

提交回复
热议问题