I have finally got my head around creating new sections in the cms using complextablefield's but i am running into a few probs. I am getting the following error when opening the popup field on some instances.
FATAL ERROR: Form::callfieldmethod() Field 'MembersList' not found
At line 590 in /Applications/MAMP/htdocs/career/sapphire/forms/Form.php
I cant find why it is happening. Here is my code...
$section = $this->Section();
if($section == 'employers') {
$title = "<h2>Employers</h2>";
$filter = "Group_Members.GroupID = 2";
$sort = "Member.ID Desc";
}else if ($section == 'candidates'){
$title = "<h2>Candidates</h2>";
$filter = "Group_Members.GroupID = 3";
$sort = "Member.ID Desc";
}
$fieldList = array(
'ID'=> 'ID',
'FirstName' => 'First name',
'Surname' => 'Surname',
'Email' => 'Email',
'Company' => 'Company',
'City' => 'City',
'Country' => 'Country',
);
$detailFields = new FieldSet();
$detailFields->push( new TextField( 'FirstName', 'Firstname' ) );
$detailFields->push( new TextField( 'Surname', 'Surname' ) );
$detailFields->push( new TextField( 'Email', 'Position' ) );
$detailFields->push( new TextField( 'Company', 'Company' ) );
$detailFields->push( new TextField( 'Address', 'Address Line 1' ) );
$detailFields->push( new TextField( 'Address2', 'Address Line 2' ) );
$detailFields->push( new TextField( 'City', 'City' ) );
$detailFields->push( new TextField( 'ZipCode', 'Zip / Postal Code' ) );
$detailFields->push( new TextField( 'Country', 'Country' ) );
$detailFields->push( new TextField( 'HomePhone', 'Telephone' ) );
$detailFields->push( new TextField( 'MobilePhone', 'Mobile Phone' ) );
$detailFields->push( new TextField( 'NumVisit', 'Number of Visits' ) );
$detailFields->push( new TextField( 'LastVisited', 'Last Visits' ) );
//$controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = ""
$sourceJoin = "LEFT JOIN Group_Members ON Member.ID = Group_Members.MemberID";
$tableList = new ComplexTableField($this,'MembersList', 'Member', $fieldList, $detailFields, $filter,$sort, $sourceJoin );
$fields = new FieldSet(
new HiddenField( 'ID' ),
$tableList
);
//$actions = new FormAction( 'doForm', 'Save Me');
return new Form($this, 'EditForm', $fields);
Can anyone help??