I would recommend not using multiple select -- it has usability difficulty for many users.
Use checkboxes. There is a nice bit of checkbox HABTM helper code lurking on the Bakery somewhere, it will help you generate them. You can then have the selected ones as checked when you load up the page. otherwise, have you tired setting the selected="selected" attribute on the options ? In a multiple select, I imagine this may work, but have never tried. Also, do you know the trick with using class="option1 option2 option3" on a SELECT, then you can use CSS to disable/hide that option... it's used for dynamic dropdwon menus, but it could be useful here. Seriously, though I wouldnt use a multiple SELECT on a form these days. hope that helps, sorry If I misunderstood question! regards Luke On Aug 6, 7:49 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is there a way for <select> <option>s generated via the selectTag > helper method to be pre-selected in a multiple select list if they > exist in a join table? Sorry, that is a dense sentence, let me see if > I can explain. > > I have two models, Product and Color. A product HABTM colors, and > colors HABTM products. On the edit product form, I am populating a > <select> element with the names of all available colors, and the color > names selected for the product at this form will be the colors > available to the user when they decide to purchase the product. For > example, if the administrator selects red, green and blue on Product > A's edit form, the end-user will have their choice of ordering the > product in one of those colors. > > So here's my question again: If an admin has already selected colors > for Product A, and then returns to Product A's edit form, is there a > way for the select options that are already in the join table to > already be selected when the form loads? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
