Problem
I have a form with two FieldGroups and a SelectionGroup in one of the FieldGroups.
The SelectionGroup Items appear in the FieldGroup form, but the radio buttons to choose one of the possibilities do not. It works again if I remove the FieldGroup.
I examined at the framework templates and found that if I change FieldGroup holder.ss SmallFieldHolder to FieldHolder, the radio boxes appear and function properly again. I’ve tried following the templates to discover which one doesn’t follow the SelectionGroup, but I’m getting nowhere.
Here’s a snippet of code as an example.
$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')
)
Asked by Rudiger
Solution #1
You could add another fieldset and give it the id=”hidden field” and aria-hidden=”true” attributes. You might perform the following in the CSS document.
#hidden_field{
display:none;
height:0;
width:0;
margin:0;
padding:0;
visibility: hidden;
}
The query behavior of SilverStripe Framework should be hidden as a result of this. Random brackets appeared in my own php forms everytime someone submitted a new form several times under different part-id numbers. On my website, I utilized this method to disguise the arbitrary brackets.
Answered by JTS
Post is based on https://stackoverflow.com/questions/42334986/silverstripe-php-forms-if-i-nest-a-selectiongroup-inside-a-fieldgroup-one-of