On Fri, Dec 14, 2012 at 7:55 PM, Chris <[email protected]> wrote:
> hi cricket,...
> this is what I got so far:
> it's kind of works,... but then again not completely,.... I'm loosing
> categories value:
>
No, you're not losing the values; you want something other than the
defaults, but haven't taken the right steps to achieve that.
> <?php echo $this->Form->create('', array('id'=>'FormId')); ?>
> <?php echo $this->Form->input("categories" , array('label' => false,
> 'type' => 'select', 'value'=>$categories, 'options'=>$categories)) ?>
>
echo $this->Form->select('categories', $categories, array('options' =>
false));
> this is output:
> where it should be
> value=arts
> value=autos
> etc...
>
You need to tell Cake that you want something other than the default id &
name when you do a find('list').
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find-list
Presumably, you have a slug column. Don't use the Category.name as the
option values because they may contain URL-unfriendly characters.
Use SluggableBehavior. There seem to be several floating around the
internet. Here's a recent one:
https://github.com/pronique/CakePHP-Sluggable-Behavior
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.