I have been working with ModelAdmin and I'm having trouble getting the fields to display the way I want. When I click the create record button the fields are displayed on the tabs I have created, but some of them I want to be inside a fieldgroup.
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new TextField('Name', 'Name'));
$fields->addFieldToTab("Root.Main", new TextField('Country', 'Country'));
$fields->addFieldToTab("Root.Main", new TextField('Continent', 'Continent'));
$fields->addFieldToTab("Root.Main", new FieldGroup(
new TextField('FirstYear', 'First Year'),
new TextField('LastYear', 'LastYear')
));
return $fields;
}
I get this error with this code.
Error: "collateDataFields() I noticed that a field called 'FirstYear' appears twice in your form: 'Form_AddForm'. One is a 'TextField' and the other is a 'TextField'" at line 140 of ....../sapphire/forms/CompositeField.php
Is this not supported in ModelAdmin, or am I missing something?