Hi Folks,
I have a few legacy apps out there using 1.1, and on one of them my
selectTags for HABTM associations are no longer picking up the
selected items. Some code (http://bin.cakephp.org/view/515620350 ):
// method in app_controller to extract selected items
function getSelectedItems ($data)
{
$return = array();
if (!empty($data) && count($data) > 0)
{
foreach ($data as $row)
{
$return[$row['id']] = $row['name'];
}
return $return;
}
return $return;
}
// sort into id/name array
$this->set('selected_categories', $this->getSelectedItems
($this->params['data']['ProductCategory']));
// outputs
Array
(
[1] => New & Exciting Resources
)
// View code - doesn't work
<?php echo $html->selectTag ('ProductCategory/ProductCategory',
$this->requestAction('/admin/products/list_categories'),
$selected_categories, array('class'=>'Multiple','size'=>'5',
'multiple'=>'multiple'), null, false); ?>
// View code - also doesn't work
<?php echo $html->selectTag ('ProductCategory/ProductCategory',
$this->requestAction('/admin/products/list_categories'),
$data['ProductCategory'], array('class'=>'Multiple','size'=>'5',
'multiple'=>'multiple'), null, false); ?>
Can anyone shed any light on this? Has there been a change to
selectTag in a recent version of 1.1?
Cheers,
Jon
--
jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---