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:

All other Modules /

Discuss all other Modules here.

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

User Defined Forms customisation


Go to End


879 Views

Avatar
kuenkuen82

Community Member, 41 Posts

26 April 2010 at 9:50pm

Edited: 26/04/2010 9:53pm

I've created a form field, which is just Yes/No

class EditableYesNoField extends EditableMultipleOptionField {
	
	static $singular_name = 'Yes/No Field';
	
	static $plural_name = 'Yes/No Fields';
	

	function getFormField() {
		$optionSet = $this->Options();
		$options = array('yes' => 'Yes', 'no' => 'No');
		
		/*if($optionSet) {
			foreach( $optionSet as $option ) {
				$options[$option->Title] = $option->Title;
			}	
		}*/
		
		return new OptionsetField($this->Name, $this->Title, $options);
	}
}

This works fine but how do I create a group of them?

Attached Files