Hi,

I hope someone can shed some light on this, it's driving me crazy. I have a 
multiple select list with options generated from a database. The problem is 
that the select name is being set, incorrectly, as follows:

name="data[Server][brand][]" 

When it should be:

name="data[Server][brand]"

This is causing problems as when an option is selected it displays in the 
URL as '.../brand[0]:Dell' which in turn throws of my search plugin as it's 
expecting '.../brand:Dell'. In my view the select box code is as follows:

echo $this->Form->create('Server', array('url' => array('action' => 
'find'), $this->params['pass'])); 
   echo $this->Form->input('brand', array(
      'type' => 'select',
      'options' => $serverBrand,
      'multiple' => 'multiple',
));

With the options being generated in the controller, like so:

$serverBrand = Set::extract('/Server/brand', $this->Server->find('all', 
array(
   'fields' => array('DISTINCT Server.brand', 'Server.brand'),
   'recursive' => -1
)));
$serverBrand = array_combine($serverBrand, $serverBrand);
$this->set('serverBrand', $serverBrand);

The array_combine is necessary in order for the select box to insert the 
correct value in the URL, I've tried commenting this out but the above 
problem still persists. I need a way to either customize the select name, 
or preferably fix it. 

Any help would be greatly appreciated!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to