I have a dataobject "workshop" where the content author adds the start date and several boxes on how many weeks each given lesson runs (these vary) along with a stop date (again number of weeks from start). Is there a way that I can autopopulate the dates for lessons and end once the information is entered?
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.
Hi Arbee,
This depends on what you're trying to achieve.
If the dates can always be calculated then you might want to not store them but instead use a function in your class to calculate on the fly.
If the dates need to be stored then using onBeforeWrite would let you set values.
https://docs.silverstripe.org/en/3.4/developer_guides/model/extending_dataobjects/