Zend form input name with same name

旧街凉风 提交于 2019-12-13 11:01:44

问题


Using Zend 1.9 I am trying to generate a form using Zend Form module . My form should be like this:

<form method="post" action="myaction">

    <input type="text" name="editors[]" />
    <input type="text" name="editors[]" />
    <input type="text" name="editors[]" />
    <input type="text" name="editors[]" />

    <button type="submit" >Go</button>

</form>

When I submit the form in my controller I want to see something like this:

Zend_Debug::dump($this->getAllParams());

//I expect this output:
array (size=4)
  'controller' => string 'myCotnroller' (length=8)
  'module' => string 'MyModule' (length=14)
  'action' => string 'test' (length=4)
  'editors' => 
    array (size=4)
      0 => string '' (length=3)
      1 => string '' (length=0)
      2 => string '' (length=0)
      3 => string '' (length=0)

I the last week I tried many and many times with no result. I have search whitout any goog result . Can you help me?


回答1:


I hope some of these will help on your quest.
Zend Framework: Working with Form elements in array notation
Advanced Zend_Form Usage
Zend_Form - Array based elements?
How do configure Zend_Form to use array notation?



来源:https://stackoverflow.com/questions/27907687/zend-form-input-name-with-same-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!