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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Setting required fields for DataObjectDecorator


Go to End


2 Posts   1151 Views

Avatar
tgfisher

Community Member, 10 Posts

27 October 2011 at 3:05am

Is it possible to define required fields using DataObjectDecorator? I am working on adding extra fields to the Member class, and from what I've read (and seen myself), extending Member is not a good idea.

Because of this, I have extended DataObjectDecorator and extended Member using my new class.

One of the fields that I've added will act as the "unique identifier field" for Member once it is extended by my class, and I need to: a) require it upon creating/editing a member, and b) ensure that the value entered is unique.

I've tried using the ForumRole class as a reference to accomplish this by creating my own Validator class and extending Member_Validator within _config.php, but it does not appear that I can define required fields using that approach.

Also something to note, I will be applying an Authenticator to this when I'm past this point to handle authentication.

Avatar
tgfisher

Community Member, 10 Posts

1 November 2011 at 1:27am

Anyone?