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

[SOLVED] Customising Member Profiles -> CheckboxSetField Problem

Go to End

2 Posts   742 Views

Optic Blaze

Community Member, 190 Posts

18 December 2013 at 9:16am

Hi there,

I am using the Member Profiles module from ajshort. I have extended the members class to allow for more fields. Everything is working well except i need a CheckboxSetField to allow for multiple selections. At the moment i get an 'Array to String conversion' error and it does not save correctly to the db.

Here is the code so far:
class MyMemberExtension extends DataExtension {

private static $db = array(
'IndustryGroup'=>'Enum(" ,Developer,EPC,Financier,Government,Installer,Independent Consultant,Legal,Manufacturer,NGO,Other")',
'NumberEmployees'=>'Enum(" ,1-9,10-49,50-99,100-199,Over 200")',


public function AddForm() {
return new Form (
new FieldList(
CheckboxSetField::create('Sectors', 'Which sectors are you intersted in?',array(
'Waste Management'=>'Waste Management',
'Hydro Electric'=>'Hydro Electric',
new FormAction('doAdd', _t('MemberProfiles.ADD', 'Add'))
new MemberProfileValidator($this->Fields())

Any help will be appreciated. Thanks

Optic Blaze

Community Member, 190 Posts

22 December 2013 at 3:00am

Ok figured it out after ajshort pointed me in the right direction

You need to extend the updateMemberFormFields function like this:

public function updateMemberFormFields(&$fields) {

$fields->push( new LiteralField('CompanyDetailsHeader', '<h2>Company details</h2>'));
$fields->push( new TextField('CompanyName', 'Company Name'));
$fields->push( new TextField('CompanyTel', 'Company Phone number'));
$fields->push( new TextField('CompanyFax', 'Company Fax number'));
$fields->push( new TextareaField('CompanyAddress', 'Company Address'));
$fields->push( new EmailField('CompanyEmail', 'Company Email Address'));
$fields->push( new TextField('CompanyWebsite', 'Company Website'));
$fields->push( new TextField('CompanyCEO', 'Company CEO'));
$myindustry = new DropdownField
('IndustryGroup', 'Select Industry Group',singleton('Member')->dbObject('IndustryGroup')->enumValues());
$myindustry->setEmptyString('-Please Select-');
$fields->push( $myindustry,'IndustryGroup');
$employee = new DropdownField
('NumberEmployees', 'Number of Employees in your company',singleton('Member')->dbObject('NumberEmployees')->enumValues());
$employee->setEmptyString('-Please Select-');
$fields->push( $employee,'NumberEmployees');
$fields->push( new CheckboxSetField('Sectors', 'Which sectors are you intersted in?',array(
"Waste Management"=>"Waste Management",
"Hydro Electric"=>"Hydro Electric",

Then it works