0
votes

I'm developing a website using cakephp 2.x.

Now, I create a form using Cakedc/search. This form has input(select/dropdown list). But the list is too long, so I want the dropdown to be view as unordered list (< ul >< li >).

Like in the lazada (search for brand): http://www.lazada.com.my/womens-watches-bags-accessories/.

the code:

<?php echo $this->Form->create('Product', array(
    'url' => array_merge(array('action' => 'search'), $this->params['pass'])));
      echo $this->Form->input('brand_id', array('label' => 'Brand', 'options' => $brands, 'empty' => 'Select Brand'));
<?php echo $this->Form->submit(__('Search', true), array('div' => false));
     echo $this->Form->end();
 ?>

Please someone help me. Thanks in advance..

1
Please elaborate on what you have tried already and what didn't work. - Max Leske

1 Answers

0
votes

You'll have to use javascript to get the id of the clicked li element or the link inside, use data attributes for that for example. Then set this value to a hidden form field or directly submit the whole form using ajax to update your results.

Your example URL is a simple list by the way that is just doing redirect on click.