Re: Multiple select selected attributes

2006-10-06 Thread lemp

Works fine, but feel a little awkward.

I'm still wondering if this a normal behavior.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Multiple select selected attributes

2006-10-06 Thread Sohei Okamoto

The array constructed by selectTag after submit contains keys as its values,
so I believe you can just array_flip() that array for next time, which
will have keys as its keys.
No need to change the helper.

Hope this helps.

Sohei

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Multiple select selected attributes

2006-10-06 Thread lemp

> Second: when my main item is saved, the HABTM are not.

Solved no2: relationship table name was not in alphabetical order
(colors_fruits).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Multiple select selected attributes

2006-10-06 Thread lemp

I have a form in which a multiple select list that represent an HABTM
relationship. The select is generated with $html->selectTag() (I
started from a baked controller).

I've got two problems.

First: when a validation error occurs, the $selected array that is
passed back to the selectTag function is  not a named array, but the
selectTag expect a named array since it use array_key_exists to check
for a match. I tried replacing array_key_exists with in_array and that
solved my problem. But I'm not sure this is really a bug. Maybe it's
the data array.

Second: when my main item is saved, the HABTM are not.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---