-- enportugal <[EMAIL PROTECTED]> wrote
(on Monday, 25 August 2008, 04:07 PM -0700):
> Allow me to disagree,
> 
> Normal? maybe.
> 
> Expected? No

Let me clarify: Normal and expected in terms of the design of the
helper.

> And for the simple reason that we don't expect this to happen when we
> are not using ZF.

This is completely a matter of perspective. The current design is due to
feature requests: developers felt that when array notation is specified,
it should act as a multi-select. For this reason, it does. 

If you disagree with the design, you are free to create your own helper
to drop in as a replacement or to file a feature request asking for
different (optional) behavior.

> Tell me how can I do this using ZF
> 
> 
> [code]<form method="post">
> 
> <select name="for[]">
> <option value="1">1</option>
> </select>
> 
> <select name="for[]">
> <option value="2">2</option>
> </select>
> 
> <select name="for[]">
> <option value="3">3</option>
> </select>
> 
> <select name="for[]">
> <option value="4">4</option>
> </select>
> 
> <select name="for[]">
> <option value="5">5</option>
> </select>

Looking at this snippet, I'd say you should probably use MultiCheckbox
instead of selects; selects are meant for use with multiple options, not
single options.

MultiCheckbox would achieve the same result with more intuitive code.


> <input type="submit" value="Send">
> 
> </form>
> [/code]
> 
> Resulting in 
> 
> [for] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
> 
> Regards,
> 
> 
> 
> Matthew Weier O'Phinney-3 wrote:
> > 
> > -- enportugal <[EMAIL PROTECTED]> wrote
> > (on Monday, 25 August 2008, 01:57 PM -0700):
> >> It's normal when naming $this->formSelect as an array, the form auto sets
> >> multple='multiple'?
> >> 
> >> This is weird and I don't think it should behave like that.
> >> 
> >> I have to manually define the index, otherwise it won't work as expected.
> >> 
> >> $this->formSelect('player[]',1,null,$options);
> >> $this->formSelect('player[]',2,null,$options);
> >> 
> >> Will create this
> >> 
> >> <select name="player[]" id="player" multiple="multiple"  >
> >> 
> >> instead of 
> >> 
> >> <select name="player[]" id="player"  >
> >> 
> >> Is this a bug or is the normal behavior?
> > 
> > Normal and expected behavior.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to