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.

Data Model Questions /

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

Make CMS form display actual field value, not the results of a getter


Go to End


1461 Views

Avatar
p0lar_bear

Community Member, 7 Posts

31 December 2015 at 8:07am

So, I extended the Member class to include a "DisplayName" field, and I wrote a getter for the field that displays either the DisplayName provided, or it concatenates the member's FirstName and Surname and shows that if the DisplayName field is empty. This works fine in templates in such, however, when I look at the member in the CMS, the DisplayName form field is populated with this calculated value if it's empty in the database.

How can I get the field to display the actual database value in CMS forms while keeping the functionality I have? I'd prefer not to have to make another calculated field that can't be set just for this purpose.