sum_tannie
sum_tannie

Reputation: 5

Cakephp URL while Paginating with search

I've a simple cakephp app with search and pagination. I'm using GET as type for forms.

When I click search with desired filters, paginated results are shown. I get desired results when I move across pages (with URL being modified with desired index of page number and filtered parameters).

Say I'm on page:4 of paginated search results. Now when I modify some search filter and hit search button again with page:4 shown, if results have less records (say that can be accommodated on one page), I get error - unable to find xxxxxx on server. (....../page:4/.... doesn't exist)..

Please help!

Upvotes: 0

Views: 180

Answers (2)

sum_tannie
sum_tannie

Reputation: 5

Resolved it as follows

$url = array('controller' => 'cc', 'action' => 'aa') + $this->request->params['pass'];
echo $this->Form->create(null, array('type' => 'get','url' => $url));

Thanks for your help.

Upvotes: 0

arilia
arilia

Reputation: 9398

when you press search usually you want to reset all or same of the paginator parameters

I guess that in your view you just did

echo $this->Form->create('Model');

in this way cake assume that the action of the form is the url of the page you are in

but you can set the url of the form this way

echo $this->Form->create('Model', array('url' => array('page' => 1));

Upvotes: 2

Related Questions