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   1048 Views

Avatar
NickJacobs

18 May 2009 at 3:57pm (Last edited: 19 May 2009 4:35pm), Community Member, 144 Posts

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

18 May 2009 at 8:27pm Forum Moderator, 5511 Posts

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

19 May 2009 at 4:35pm (Last edited: 19 May 2009 4:35pm), Community Member, 144 Posts

Great, thanks Will, thats it.