Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ss 3.0.2 timed out session on reload search results


Go to End


2 Posts   1208 Views

Avatar
longy

Community Member, 5 Posts

12 November 2012 at 7:25am

Edited: 12/11/2012 8:41am

Following this guide: SearchContext Guide, I built a custom search with pagination, but if i reload result page (by pressing f5) or change page (by pagination links) i get an unformatted page with the following message:

Sorry, your session has timed out.

If if could serve after I change getResults method from tutorial into(changed lines of code in red):

         public function getResults($searchCriteria = array()) {
	    $start = ($this->request->getVar('start')) ? (int)$this->request->getVar('start') : 0;
	    $limit = 1;	         
	    $context = singleton('myObj')->getCustomSearchContext();
	    $records = $context->getResults($searchCriteria, null, array('start'=>$start,'limit'=>$limit));
 	    $allrecords = $context->getResults($searchCriteria);
	    if($records) {
	        $records = new PaginatedList($records, $this->request);
	        $records->setPageStart($start);
		$records->setPageLength($limit);
	        $records->setTotalItems(count($allrecords));
	    }
	    return $records;
	}

What's wrong?

Thanks in advance for help.

Avatar
longy

Community Member, 5 Posts

13 November 2012 at 2:21am

There is a way to solve using 'post' method (without disabling security token)?

At the moment solved using:

$form->setMethod('get');