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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Frontend form fields

Go to End

5 Posts   1965 Views


Community Member, 6 Posts

10 July 2011 at 10:26pm

Edited: 10/07/2011 10:40pm

I am using the memberprofile module. To add a date field for Date of Birth and a Gender dropdown, I have extended the Members class by doing the following:

class Customregfields extends DataObjectDecorator{
	function extraStatics(){
		return array(
			'db' => array(
        		    'Gender' => "Enum(',Male,Female','')",
                            'DOB' => "Date"

What do I need to do to achieve the following?
1. Have the Date of Birth field display in the frontend registration form as three dropdowns Day, Month, Year.
2. Change the Gender dropdown to radio buttons.


Forum Moderator, 1899 Posts

11 July 2011 at 8:23pm

Hi Tee808,

This should work for (1), but I don't have an answer for (2)... hope it helps!

function getCMSFields() {
	$fields = parent::getCMSFields();
	$df = new DateField('DOB','Date Of Birth');
	$df->setConfig('showcalendar', true);
	$df->setConfig('dateformat', 'dd/MM/YYYY');

	return $fields;

Note I am in the UK, so I use UK date format and I believe the (very confusing to me) US format is the default so you shouldn't need the last two lines...


Community Member, 6 Posts

11 July 2011 at 10:45pm

Thanks for your reply. I'm not sure you understood what I am needing though.

I'm wanting three dropdowns: day, month and year.


Forum Moderator, 1899 Posts

11 July 2011 at 10:52pm

ah, my bad, totally doesn't do that, it can provide three boxes - but I wrote a massive amount of custom code to do three dropdowns - not something that can be summed up in three lines... sorry for the confusion...


Forum Moderator, 1899 Posts

5 December 2011 at 4:11am

I have just gone back to revaluate my code and found this...

...thought I'd update the thread