I'm struck with a Zend paginator issue for the past two days.
My html side
I have a form with 4 checkboxes on clicking any of these checkboxes the form will submit using jquery and based on that value Zend paginator result will occour My question is How can i submit the form when pagination links ( 1 2 3..) since it is a url
<form name="frm_submit" id="frm_submit" action="" method="post">
<input type="text" name="search" id="search" />
<input type="checkbox" name="opt1" id="opt1" />
<input type="checkbox" name="opt2" id="opt2" />
<input type="checkbox" name="opt3" id="opt3" />
<input type="checkbox" name="opt4" id="opt4" />
</form>
/**Controller/Action**/
$searchdata = $this->someFun($checkboxval,$searchtextboxval); //A function returning some data based on the checkbox value
$paginator = Zend_Paginator::factory($searchdata);
$paginator->setItemCountPerPage(10);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
The problem is I cant get the checkbox value in the server side when user click a pagination link(Eg 1 2 3 Next.) ? How can i do this ?
1) Add attribute value
to you input checkboxes, which holds the number of page you want to display, i.e.:
<input type="checkbox" name="opt1" id="opt1" value="1" />
2) Add the value of clicked checkboxes to the url as param:
URL?page=1
3) Retrieve page param in controller action and pass it to the paginator:
$params = $this->getRequest()->getParams();
if (isset($params['page']))
$page = $params['page'];
else
$page = 1;
$paginator->setCurrentPageNumber($page);