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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

[SOLVED]Change sort order on SubmittedFormReportField


Go to End


3 Posts   1333 Views

Avatar
NickJacobs

Community Member, 148 Posts

18 May 2009 at 3:57pm

Edited: 19/05/2009 4:35pm

Hi, can anyone tell me how I can change the order that Submitted form responses show up in the CMS?? (I just want them in descending order so that latest are at the top of the page...)

cheers

Avatar
Willr

Forum Moderator, 5523 Posts

18 May 2009 at 8:27pm

These instructions are based off userforms 0.2 but will probably work in 0.1 (with line numbers slightly diff

The function which returns the list of results is Submissions() in SubmittedFormReportField.php (line 20). Rather then just returning the values you will need to sort them then return them like this

	function Submissions() {
		$submissions = $this->form->getRecord()->Submissions();
		if($submissions) $submissions->sort('Created', 'DESC'); // sort if they exist
		return $submissions;
	}

Avatar
NickJacobs

Community Member, 148 Posts

19 May 2009 at 4:35pm

Edited: 19/05/2009 4:35pm

Great, thanks Will, thats it.