Why in your view you don't pass the 'selected' paramether to the
helper function?
i.e.
$html->selectTag('fieldName', $arrayOfOptions, $id);
Where $id is the selected item.
Dan
On 30 Set, 10:37, Lian3W <[EMAIL PROTECTED]> wrote:
> Hello. I'm making a photographer's portfolio in Cake 1.1 and I have a
> little problem (I'm new into Cake).
>
> I have 3 tables:
> - categories
> - galleries
> - photos
>
> An they're related: Category hasMany Gallery; Gallery hasMany Photo.
>
> I just want that when I go to "/galleries/new/1", it autoselects the
> correspondent option in the category_id combo box in that view.
>
> In the galleries_controller.php, function new($gallery_id = null), I
> do $this->set('listCategories', $this->Galery->Category-
>
> >generateList());
>
> And in the view (galleries/new.thtml), to create the field, I do <?php
> echo $html->selectTag('Gallery/category_id', $listCategories); ?>
>
> It perfectly autopopulates the combo box, but I'm lost in how to make
> it auto-select the gallery id that I pass thru URL !!!
>
> BTW... One of the problems I see is that ids of categories table
> aren't consecutive, so I can't try selecting the nth option based on
> the number at the URL, I'm kinda frustrated.
>
> Thanks,
> Emiliano
>
> PS: Sorry for my english...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---