Project

General

Profile

Actions

Bug #91610

closed

Fluid Forms Label and name can´t be an integer. -> Request Class TYPO3 9.5

Added by Benjamin Bomberg over 4 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-06-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Forms, Fluid, Extbase
Complexity:
Is Regression:
Sprint Focus:
Actions #1

Updated by Benjamin Bomberg over 4 years ago

  • Subject changed from Fluid Forms Label and name can´t be an integer. to Fluid Forms Label and name can´t be an integer. -> Request Class
  • Category set to Fluid Styled Content
  • PHP Version set to 7.3
  • Tags set to Forms, Fluid, Extbase

I got a little Problem with the Request Class of Typo3.

I have to use ID ´s from an Api to generate input fields for a fluid form.
The Problem here is:

public function setArgument($argumentName, $value)
    {
        if (!is_string($argumentName) || $argumentName === '') {
            throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException('Invalid argument name.', 1210858767);
        }
        if ($argumentName[0] === '_' && $argumentName[1] === '_') {
            $this->internalArguments[$argumentName] = $value;
            return;
        }
        if (!in_array($argumentName, ['@extension', '@subpackage', '@controller', '@action', '@format', '@vendor'], true)) {
            $this->arguments[$argumentName] = $value;
        }
    }

!is_string let me get an error all the time.

 <label for="{question.id}">{question.label}</label>
 <f:form.textfield class="form-control" name="{question.id}" additionalAttributes="{required: 'required'}"/>

The Problem is, that I have to send the inputs back to the Api, thats why I need the Id.
It´s also a problem that I dont know how many or what type of inputs coming from the API. It could be one, it could be 20...
Is there a solution for this? I dont want to change something in the core-code. And XClasses doenst work here right?

Best Regards,
Benjamin

Actions #2

Updated by Benjamin Bomberg over 4 years ago

  • Subject changed from Fluid Forms Label and name can´t be an integer. -> Request Class to Fluid Forms Label and name can´t be an integer. -> Request Class TYPO3 9.5
Actions #3

Updated by Georg Ringer about 4 years ago

  • Tracker changed from Feature to Bug
  • Category changed from Fluid Styled Content to Extbase
  • TYPO3 Version set to 10
Actions #4

Updated by Gerrit Code Review about 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66215

Actions #5

Updated by Markus Klein about 4 years ago

Sidenote: Your label for-attribute is invalid, as the textfield does not have an "id" attribute (which must not be a number).
Correct HTML would be:

<label for="q{question.id}">{question.label}</label>
<f:form.textfield class="form-control" id="q{question.id}" name="{question.id}" additionalAttributes="{required: 'required'}"/>
Actions #6

Updated by Christian Kuhn about 3 years ago

  • Status changed from Under Review to New
Actions #7

Updated by Riccardo De Contardi 5 months ago

Actually, on HTML5 it is valid to begin an ID attribute with number; however it is NOT valid for CSS (as CSS selector, the ID is not valid if it starts with a number).

Actions #8

Updated by Garvin Hicking 5 months ago

  • Status changed from New to Closed

Since the proposed patch has not really yielded anything fruitful and further movement, I believe this will remain "as is" for the foreseeable future.

I would suggest to use an argument prefix like "idArguments[...]" and wrap those arguments in such an array to be passed and later mapped. Or maybe use a TypeConverter to rename arguments later on.

I believe having number-only variable names / keys also is not a general recommendation (also PHP does not allow $12345 as a valid variable).

I hope you can understand the reasoning and need for us to clean up the issues. If you feel this is a mistake or have additional feedback, please get in touch. You can also create a follow-up issue.

Actions

Also available in: Atom PDF