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:
----------------------------------------------------------------------------
MyMemberExtension.php
-----------------------------------------------------------------------------
class MyMemberExtension extends DataExtension {
private static $db = array(
'CompanyName'=>'Varchar(255)',
'CompanyTel'=>'Varchar(12)',
'CompanyFax'=>'Varchar(12)',
'CompanyAddress'=>'Varchar(255)',
'CompanyEmail'=>'Varchar(255)',
'CompanyWebsite'=>'Varchar(255)',
'CompanyDescription'=>'Text',
'CompanyCEO'=>'Varchar(100)',
'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")',
'Newsletter'=>'Enum("Yes,No")',
'Sectors'=>'Varchar(255)'
);
---------------------------------------------------------------------------------
MemberProfilePage.php
----------------------------------------------------------------------------------
public function AddForm() {
return new Form (
$this,
'AddForm',
$this->getProfileFields('Add'),
new FieldList(
CheckboxSetField::create('Sectors', 'Which sectors are you intersted in?',array(
'Wind'=>'Wind',
'SWH'=>'SWH',
'Biogas'=>'Biogas',
'Biomass'=>'Biomass',
'Waste Management'=>'Waste Management',
'Hydro Electric'=>'Hydro Electric',
'PV'=>'PV',
'CSP'=>'CSP',
'Other'=>'Other'
)),
new FormAction('doAdd', _t('MemberProfiles.ADD', 'Add'))
),
new MemberProfileValidator($this->Fields())
);
}
Any help will be appreciated. Thanks