Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkboxes in sheet sections always have the same id #1624

Closed
MatthiasPeltzer opened this issue Oct 3, 2018 · 4 comments
Closed

Checkboxes in sheet sections always have the same id #1624

MatthiasPeltzer opened this issue Oct 3, 2018 · 4 comments

Comments

@MatthiasPeltzer
Copy link

MatthiasPeltzer commented Oct 3, 2018

Environment:

  • TYPO3 9.5.0
  • Flux 9.1.0

Hi there,
first of all... thx for all your work and this nice and very helpful extension. 馃挴

I don麓t know if its a bug. This problem does not occur in TYPO3 8!

`<f:section name="Configuration">
<flux:form id="accordion">
<flux:form.option.group value="Inhaltselemente" />
<flux:form.option.icon value="/typo3conf/ext/my_template/Resources/Public/Images/Icons/Backend/previewicon_accordion.gif" />

    <flux:form.sheet name="panels">
        <flux:form.section name="panels">
            <flux:form.object name="panel">
                <flux:field.input name="title" />
                <flux:field.checkbox name="active" />
            </flux:form.object>
        </flux:form.section>
    </flux:form.sheet>
</flux:form>

<flux:grid>
    <f:for each="{panels}" as="panel" key="panelKey" iteration="panelIteration">
        <flux:grid.row>
            <flux:grid.column name="content.{panelKey}" colPos="{panelIteration.cycle}" label="{panel.panel.title}" />
        </flux:grid.row>
    </f:for>
</flux:grid>

</f:section>`

With TYPO3 9.5.0: If you apply more than one section the <flux:field.checkbox name="active" /> inside the section can麓t be selected, because they all got the same ID:

<input class="checkbox-input" value="1" ... id="data_tt_content_207_pi_flexform_active_0" type="checkbox">

also the label has the same "for" attribute:

<label class="checkbox-label" for="data_tt_content_207_pi_flexform_active_0">

So it麓s not possible to select them seperatly.

Maybe i am doing something wrong or is it a bug?
Thank you for your efforts and best regards

Matthias

@NamelessCoder
Copy link
Member

Thanks for the kind words Matthias! I'm afraid this one is most likely a TYPO3 core bug - it wouldn't be the first time we've seen similar misbehaviors for features associated with fields, in that they work differently outside and inside FlexForms (and inside/outside sheets in FlexForms). In this case it appears the field rendering mechanism (FormEngine) fals to take into consideration that the field is used inside a section.

The solution would be to add a numeric part to the ID (and for) attribute values when the field is inside a sheet.

And that's a fix that has to be implemented in TYPO3 itself. In this case I'm not even able to provide a workaround since anything you could do with unique field names will have severe side effects regardless how you attempt to handle it.

Just on a side note, Flux doesn't render any HTML for fields and can only provide the attributes that are supported by TCA. So we are limited to providing fields and their hierarchy and assuming (expecting) FormEngine to render everything correctly.

PS: Since you're using section objects to create grids you may find #1582 interesting. You are probably aware of the drawbacks when removing or re-sorting section objects and this PR aims to completely solve that while also making the section-object-becomes-column logic easier to use.

@lneugebauer
Copy link

Hi Matthias,
I'm having the same issue as you with TYPO3 9.5.1 and FLUX 9.1.0.

As a "workaround" you can save between creating a new object. It seems like TYPO3 is generating a new ID after saving the content element.

Lukas

@mschmitz89
Copy link

Any news to fix this?

I've created a bug tracker issue for this problem here: https://forge.typo3.org/issues/87429

@NamelessCoder
Copy link
Member

Please follow the issue in the core tracker (and thanks for creating it!) - this is not a Flux problem so we can't address it from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants