在FieldList中使用FieldGroup会导致样式问题,特别是上传时

时间:2016-09-16 05:52:42

标签: php forms silverstripe fieldset

我在主题中有一个表单有两个fieldsets我使用FieldGroup来做。该字段具有文档上载区域。当我将上传区域放入标准FieldList时,它可以很好地使用漂亮的拖放区域,但是当它放在FieldGroup时会丢失格式:

这有很好的造型:

$form = Form::create(
    $this,
    __FUNCTION__,
    FieldList::create(
        TextField::create('Name', 'Name')->setAttribute('required', true)->setAttribute('placeholder', 'Name'),
        $doc = new UploadField('Document')
    ),
    FieldList::create(
        FormAction::create('submit', 'Submit')->setAttribute('class', 'btn  btn-success')
    ),
    RequiredFields::create(
        'Name', 'Document'
    )
);

但它在这里迷失了:

$form = Form::create(
    $this,
    __FUNCTION__,
    FieldList::create(
        FieldGroup::create(
            HeaderField::create('Document'),
            TextField::create('Name', 'Name')->setAttribute('required', true)->setAttribute('placeholder', 'Name'),
            $doc = new UploadField('Document')
        )
    ),
    FieldList::create(
        FormAction::create('submit', 'Submit')->setAttribute('class', 'btn  btn-success')
    ),
    RequiredFields::create(
        'Name', 'Document'
    )
);

我正确使用FieldGroup吗?

0 个答案:

没有答案