-- drj201 <drj...@gmail.com> wrote
(on Monday, 02 February 2009, 02:05 PM -0800):
> I have a Zend_Form object which uses the GET method of submission. Creating
> a new instance of my zend form and displaying it in the view works fine. By
> default, on submission of the form the browser is directed to the set action
> in my Zend_Form and the GET params are set to include those elements from my
> form such as:
> 
> http://www.example.com/search?index=news&submit=submit
> 
> Question 1) Can I specify which GET params to pass to my form action? For
> example the "submit=submit" is not needed and is included by default because
> of the 'submit' element specified in my Zend_Form.

No -- HTML forms submit all elements in the form (with the exception of
unchecked checkboxes, for some reason).

> Question 2) I wish to specify an array in my GET params such as:
> 
> http://www.example.com/search?index[]=news&index[]=articles&submit=submit
> 
> As mentioned in question 1 by default the GET params sent correspond to the
> elements in the Zend_Form object so as there is a text element with the
> id/name of 'index' and the value of 'news' the GET param is set as
> "index=news". If I change the name/id of the 'index' text element to
> 'index[]' the GET param still reads as 'index' ignoring the array. Am I
> doing something wrong or can this not be done using Zend_Form? I have tried
> to pass an array to the setValue but it only accepts a string.

Set the isArray property of the element: $element->isArray(true);

-- 
Matthew Weier O'Phinney
Software Architect       | matt...@zend.com
Zend Framework           | http://framework.zend.com/

Reply via email to