Issue Bug Closed

#98225Add class attribute to EXT:form form-tag results in exception

Stefan Froemken 08/29/22, 09:47 updated 10/15/24, 09:30

Description

Hello Form-Team,

I just try to add a css class to form-tag.

type: Form
identifier: newEvent
label: Create a new event
prototypeName: standard
renderingOptions:
  submitButtonLabel: Submit
properties:
  fluidAdditionalAttributes:
    class: withtip frame-indent
renderables:

In Form.html of EXT:form I have found that line:

additionalAttributes="{formvh:translateElementProperty(element: form, property: 'fluidAdditionalAttributes')}"

So I was optimistic that it should work, but it results in:

(1/1) #1325697085 InvalidArgumentException
The options "properties" were not allowed (allowed were: "rendererClassName, renderingOptions, finishers, formEditor, label, variants")

Stefan

Reviews 2

History 512

  1. Stefan Froemken commented <span data-processor="relativetime" data-value="2022-08-29T09:53:36+00:00" > 08/29/22, 09:53 </span>

    Argh, for form-tag the option “fluidAdditionalAttributes” is part of “renderingOptions”. That’s very confusing, as for all other elements this option is part of “properties”. Have a look into the preview of all these search results. They all start with “properties.fluidAdditionalAttributes”:

    https://docs.typo3.org/c/typo3/cms-form/main/en-us/search.html?q=fluidAdditionalAttributes&check_keywords=yes&area=default

    Maybe that should be updated somewhere in the documentation.

  2. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-06-14T10:25:14+00:00" > 06/14/24, 10:25 </span>

    Do you have a suggestion on how to reword this and would like to make a PR? :-)

  3. Gerrit Code Review pushed patch set 1 for main to change 84727 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2024-06-16T11:22:17+00:00" > 06/16/24, 11:22 </span>

  4. Stefan Froemken commented <span data-processor="relativetime" data-value="2024-06-16T11:58:05+00:00" > 06/16/24, 11:58 </span>

    Hello. I have extracted the FormDefinition section of EXT:form documentation into its own documentation section as FormDefinition is IMO not part of a form element. Sure, both are extending the AbstractRenderable, but under the hood FormDefinition allows a completely different set of options.

    FormElements:

    ArrayUtility::assertAllArrayKeysAreValid(
        $options,
        ['label', 'defaultValue', 'properties', 'renderingOptions', 'validators', 'formEditor', 'variants']
    );

    Form:

    ArrayUtility::assertAllArrayKeysAreValid(
        $options,
        ['rendererClassName', 'renderingOptions', 'finishers', 'formEditor', 'label', 'variants']
    );

    As you can see Form does not allow option properties.

    While processing the fluidAdditionalAttributes there is a check to differ between it’s a Form or FormElement. For FormElement the well known properties are used, but if it’s a Form it internally switches to retrieve the properties from renderingOptions.

    https://github.com/TYPO3/typo3/blob/main/typo3/sysext/form/Classes/Service/TranslationService.php#L269-L286

    I have kept the header links to not damage the internal and external linking.

  5. Stefan Froemken commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-08-02T08:20:08+00:00" > 08/02/24, 08:20 </span>

    Applied in changeset commit:71175081b6c35592e1ae70d0dbdf8fb4d8fa9645.