Jump to:

10848 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » [SOLVED]Change sort order on SubmittedFormReportField

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1008 Views
  • NickJacobs
    Avatar
    Community Member
    144 Posts

    [SOLVED]Change sort order on SubmittedFormReportField Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [SOLVED]Change sort order on SubmittedFormReportField Link to this post

    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;
       }

  • NickJacobs
    Avatar
    Community Member
    144 Posts

    Re: [SOLVED]Change sort order on SubmittedFormReportField Link to this post

    Great, thanks Will, thats it.

    1008 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.