The selectTag has a third (or fourth) parameter after the name/value arrays
parameter that accepts selected single name or array of names. Matching name
from name/value parameter and selected name parameter will have the selected
attribute on the generated HTML tag.

Let me know if you need more code details.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of igor
Sent: 14 Desember 2006 18:30
To: Cake PHP
Subject: Edit form for associated tables


Hello,

I have the following tables in the database: products, manufacturers,
subcategories. Product has one manufacturer (associated with belongsTo
/ and hasMany the other way around) and multiple subcategories (HABTM).
I created index, view, add and edit views, everything is working
_almost_ perfectly. When I add or edit product, I get a drop-down list
of producers and multiple-choice list of subcategories (created with
generateList in the controller, $html->selectTag in the view).

There's only one minor flaw. When I edit an existing product, I need to
have a manufacturer and subcategories selected. I tried the manual and
some tutorials from Cake Wiki, but couldn't find a solution - and I'm
sure there must be a simple way.

Igor




--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to