this is what I got so far:
it's kind of works,... but then again not completely,.... I'm loosing categories value:
<?php echo $this->Form->create('', array('id'=>'FormId')); ?>
<?php echo $this->Form->input("categories" , array('label' => false, 'type' => 'select', 'value'=>$categories, 'options'=>$categories)) ?>
<script type="text/javascript">
$('#FormId select').change(function(){
window.location.href = ('/videos/category/' + $(this).val());
})
</script>
</form>
this is output:
| <form action="/videos" id="FormId" method="post" accept-charset="utf-8"><div style="display:none;"><inputtype="hidden" name="_method" value="POST" /></div> <divclass="input select required"><select name="data[Video][categories]" id="VideoCategories"> | |
| <option value="0"selected="selected">general</option> | |
| <option value="1">arts</option> | |
| <option value="2">autos</option> | |
| <option value="3">animals</option> | |
| where it should be value=arts value=autos etc... |
On Friday, December 14, 2012 11:32:53 AM UTC-8, cricket wrote:
That's because you're passing the ID of the form, not the select
widget. It's the select that changes.
On Fri, Dec 14, 2012 at 2:20 AM, Chris <chri...@yahoo.com> wrote:
> ok cricket,... I bypass helper,... set categories in a controller which
> reads from bootstrap,... but still can't get it work from select box,...
>
> <?php echo $this->Form->create('', array('id'=>'FormId')); ?>
> <?php echo $this->Form->input("categories" , array('label' => false, 'type'
> => 'select', 'options'=>$categories)) ?>
>
> <script type="text/javascript">
>
> $('#FormId').change(function(){
> window.location('/videos/category/' + $(this).val());
> });
>
> </script>
> </form>
>
> can you take a look of it if you don't mind please,... select box located
> right in the middle,... on top of video thumbs,...
>
> http://www.hamayk.com/videos
>
> thanks
>
>
>
> On Thursday, December 13, 2012 6:52:34 PM UTC-8, cricket wrote:
>>
>> With JQuery that's a snap:
>>
>> $('#your_category_select_id').change(function(){
>> window.location('/categories/view/' + $(this).val());
>> });
>>
>> I've no idea how to do it with the Helper as I've never used it.
>>
>> Personally, I'd leave the 'view' part out so the URLs are like
>> '/categories/monitors', '/categories/keyboards', etc. which I think
>> looks a bit sharper.
>>
>> Just be sure to set up the routes properly for all other
>> CategoriesController actions, then create a route after them like:
>>
>> Router::connect(
>> '/categories/:slug',
>> array(
>> 'controller' => 'categories',
>> 'action' => 'view'
>> ),
>> array(
>> 'slug' => '[-a-z0-9]+',
>> 'pass' => array('slug')
>> )
>> );
>>
>> Then just set up the model to return Category.slug instead of id when
>> you do a find('list').
>>
>> On Thu, Dec 13, 2012 at 8:13 PM, Chris <chri...@yahoo.com> wrote:
>> > hi criket,...
>> > I have a links too,... but it looks ugly to display with video
>> > thumbs,... I
>> > need it to jump to category page once it selected from select box,... I
>> > guess I have to do it with js,...
>> >
>> > thanks
>> >
>> >
>> > On Thursday, December 13, 2012 4:49:22 PM UTC-8, cricket wrote:
>> >>
>> >> Do you mean jump to the category down the page? Use an id on the
>> >> header for the category and then use JS to change the window location
>> >> to '#' + your_id. But why not just create normal links rather than use
>> >> a select box?
>> >>
>> >> Or do you mean something altogether different? Your question is a bit
>> >> vague.
>> >>
>> >> On Thu, Dec 13, 2012 at 7:09 AM, Chris <chri...@yahoo.com> wrote:
>> >> > hi guys,...
>> >> > how can I link and jump to selected category from select box once it
>> >> > selected,...?
>> >> > I'm reading categories from helper:
>> >> > <?php echo $this->Form->input("categories" , array('label' => false,
>> >> > 'type'
>> >> > => 'select', 'options'=>$application->video_category())) ?>
>> >> >
>> >> > thanks in advance
>> >> > chris
>> >> >
>> >> > --
>> >> > 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...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > cake-php+u...@googlegroups.com.
>> >> > Visit this group at http://groups.google.com/group/cake-php?hl=en .
>> >> >
>> >> >
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > cake-php+u...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en .
>> >
>> >
>
> --
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com .
> Visit this group at http://groups.google.com/group/cake-php?hl=en .
>
>
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.
No comments:
Post a Comment