Re: select box link and jump to selected category
On Fri, Dec 14, 2012 at 7:55 PM, Chris <chris69m@yahoo.com> 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').
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:
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 cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home