Jump to:

3448 Posts in 1062 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » SS3 required fields on page

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

Page: 1
Go to End
Author Topic: 603 Views
  • EdP
    Avatar
    Community Member
    13 Posts

    SS3 required fields on page Link to this post

    I have a custom field that I need to be required (and not allow the page to save if it is not present). With SS2 I followed this post's (http://www.silverstripe.org/data-model-questions/show/6128 advice and had the following in my page class (after the statics and before the getCMSFields function:

    function getCMSValidator() {
    return new RequiredFields('ConcertDate');
    }

    This no longer correctly works in SS3 (raises error but does allow a new page to be saved) so I suspect there is a new way? Any help much appreciated.

  • soolan
    Avatar
    Community Member
    11 Posts

    Re: SS3 required fields on page Link to this post

    I have the same problem.

    I need to validate a couple of fields in the backend.
    But I didn't find any solution.

    I found this thicket
    http://open.silverstripe.org/ticket/2915
    which was set to: WONTFIX 2 weeks ago

    can anyone please give us a solution for this issue.

    Thanks for your time

  • Ironcheese
    Avatar
    Community Member
    33 Posts

    Re: SS3 required fields on page Link to this post

    In my case

    public function getCMSValidator(){
    return new RequiredFields('Code', 'Name');
    }

    worked like a charm.
    I'm using SS3.0

    603 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.