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.

General Questions /

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

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

ss 3.0.2 timed out session on reload search results


Reply


2 Posts   464 Views

Avatar
longy

Community Member, 5 Posts

12 November 2012 at 7:25am

Edited: 12/11/2012 8:41am

Following this guide: [url=http://doc.silverstripe.com/framework/en/reference/searchcontext]SearchContext Guide[/url], 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');