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.

General Questions /

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

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

Autopopulate Date


Reply


5 Posts   835 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.