Help: Search Form type get (CakePHP 3)

Hi guys,

i have a simple search form with method get like this:

<?= $this->Form->create('Search',['type'=>'get']) ?>
<fieldset>
    <legend><?= __('Search') ?></legend>
    <?php
        echo $this->Form->input('id');
    ?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>

On my routes.php i have the router control:

$routes->connect(
    '/test/search/:id',
    array('controller' => 'test', 'action' => 'search'), // Local à ser redirecionado
    array(
       'pass' => array('id'),
       'id' => '[0-9]+'
));

To control my url like: /test/search/:search_id.

The problem is my form send the request to /test/search?id=:search_id.
What i need to do, to form send to the correct url: /test/search/:search_id ??

Thanks.

Hi,

i resolve this issue, adding a rout controller on the AppController.beforeFilter like this:

        parent::beforeFilter($event);
        if($this->request->is('get') && $this->request->query){
            
            $config['controller'] = $this->request->params['controller'];
            $config['action']     = $this->request->params['action'];                
            foreach($this->request->query as $k=>$v) $config[] = $v;
            
            return $this->redirect($config);
        }

Now, all get requests like ?par1=x&par2=y&parN=z goes to /x/y/z for all actions.