Hi there, I struck the same issue with Paginator and no easy way to
preserve any form data posted by the original form when navigating
around subsequent pages. I wasn't keen to go down the route of
serialzing the posted data and re-directing to a new controller action
as described by Joe above. Instead I used the Session helper to store
the form data and test for it in each subsequent page delivered by the
Paginator. See below...
// the form has posted some search criteria, add it into the
$criteria_post array
if(!empty($this->data["Search"]["rate"])){
$criteria_post["Candidate.rate"] = $this->data["Search"]["rate"];
}
// read in the session variable
$criteria_session = $this->Session->read('Search.criteria');
if(!empty($this->data["Search"])){
$criteria = $criteria_post;
$this->Session->del('Search.criteria'); // we have new search
variables posted in, so remove the old session variable
$this->Session->write('Search.criteria',$criteria); // then write a
fresh, new session variable
}elseif(!empty($criteria_session)){ // but if we have no new fresh
search criteria revert to any session search criteria
$criteria = $criteria_session;
}else{
$criteria = array();
}
// then pass the criteria, regardless of where its from into the
Paginator helper
$data = $this->paginate('Application', $criteria);
Worked for me anyway. Hope it helps someone else.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---