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

DateField - Separate fields "Day, Month, Year" FieldType -> Dropdown


Reply


7 Posts   743 Views

Avatar
mcohrs

Community Member, 5 Posts

5 September 2013 at 1:27pm

Hi Guys,

I have been serarching and trying and searching for a solution.

Unfortunately without any success yet.

Im trying to display a Datefield on the front end a three seperate dropdown fields "Day, Month, Year".

I am aware of following option within the dateField options:
DateField::create('MyDate')
->setConfig('dmyfields', true);
->setConfig('dmyseparator', '/') // set the separator

Unfortunately does this not render 3 pre populated drop downs for "Day, Month, Year".

Can someone please give me some advise on how to achieve this ?

Thanks a lot in advance !!!

Best regards,
Marcel

Avatar
Willr

Forum Moderator, 5513 Posts

7 September 2013 at 2:07pm

dmy fields uses separate text input fields. https://github.com/dnadesign/silverstripe-datedropdownselectorfield uses dropdown fields for the date selector.

Avatar
heinvd

Community Member, 5 Posts

14 March 2014 at 3:27am

Sorry to wake up old cows, but is there not by now with SS 3.1.3 a way to do this without using addon modules as such?

I am still stuck on this question and would like to do this using legacy SS and not some addon if possible.

Avatar
Willr

Forum Moderator, 5513 Posts

14 March 2014 at 9:19am

No, this continues to be a module (and will always be). Core is designed to be as light as possible so variations of form fields like this are kept separate. In the future we'll see more stripped out of core into modules than module code going into core :)

Avatar
heinvd

Community Member, 5 Posts

14 March 2014 at 8:52pm

Thanks Willr, that makes allot of sence. What be the best module to use for forms in general?

Avatar
Willr

Forum Moderator, 5513 Posts

14 March 2014 at 9:04pm

Forms in general? None. Some modules (like gridfieldextensions) provide a bucket of form fields to use but most fields are individual modules so you can use modules when you need to (like the date drop down selector). Some I use quite often are spam protection form field and since we're NZ based, the NZ specific field module (https://github.com/silverstripe-labs/silverstripe-formfields_nz) which contains NZ specific form fields / validation.

The addon's site contains a list of form modules - http://addons.silverstripe.org/add-ons?search=form.

Avatar
heinvd

Community Member, 5 Posts

14 March 2014 at 9:48pm

Thanks Willr for the guidance. I will go check it out. I am in Cape Town, South Africa. We are rebuilding all our systems on SS. I am an x spagetti coder, so going the OO way is quite new. But what I have learned in SS, I love it. Would like to be an SS guru soon ;)

Thanks again, Have a good one.