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.

All other Modules /

Discuss all other Modules here.

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

[SOLVED]Change sort order on SubmittedFormReportField


Reply


3 Posts   1101 Views

Avatar
NickJacobs

Community Member, 144 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, 5513 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, 144 Posts

19 May 2009 at 4:35pm

Edited: 19/05/2009 4:35pm

Great, thanks Will, thats it.