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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Autopopulate Date


Go to End


5 Posts   1398 Views

Avatar
headless_pnub

Community Member, 17 Posts

12 March 2009 at 6:41am

Hi all,

I'm looking to have the date automatically added to the field when a new news item is created just in case I have any lazy users who don't bother or forget.

Is this possible/can you give me a clue?

Thanks in advance,
Pnub

Avatar
Ben Gribaudo

Community Member, 181 Posts

12 March 2009 at 7:26am

Hi Pnub,

Does populateDefaults() do what you want?
http://doc.silverstripe.org/doku.php?id=recipes:populatedefaults

Ben

Avatar
headless_pnub

Community Member, 17 Posts

13 March 2009 at 3:11am

Hi Ben,

Thanks, that does look like what I want. Hope would I implement that? ie: where would i put the code?
Thanks again,

Pnub

Avatar
Ben Gribaudo

Community Member, 181 Posts

13 March 2009 at 3:58am

Hi Pnub,

Try placing it in your news item class.

Ben

Avatar
headless_pnub

Community Member, 17 Posts

13 March 2009 at 5:06am

Brilliant, thank you so much.