Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

SilverStripe PHP Forms - If I nest a SelectionGroup inside a FieldGroup, one of the related SelectionGroup_Items' Radio Box does not show up. Why?


I have a form that has two FieldGroups, and in one of the FieldGroups I have a SelectionGroup.
The SelectionGroup_Items show up in the form FieldGroup but the radio boxes to select one of the options doesn't show. If I remove the FieldGroup it then works again.
I've looked at the framework templates, and if I change the FieldGroup_holder.ss SmallFieldHolderto FieldHolder the radio boxes appear again and work correctly. I've tried following the templates to see which one isn't obeying the SelectionGroup but I keep getting lost.
Here's an example bit of code
$fields = FieldList::create(
    FieldGroup::create(
        TextField::create('Name', 'Name')
    ),
    FieldGroup::create(
        SelectionGroup::create(
            'Test1or2',
            array(
                SelectionGroup_Item::create(
                    'Test1', array(
                        TextField::create('Test1', 'Test1')
                    ),
                    'Test1'
                ),
                SelectionGroup_Item::create(
                    'Test2', array(
                        TextField::create('Test2', 'Test2')
                    ),
                    'Test2'
                )
            )
        )
    )
),
FieldList::create(
    FormAction::create('submit', 'Submit')
)

Comments