Project

General

Profile

Actions

Bug #102802

closed

EXT:form: url for form action attribute is missing

Added by Sven Burkert 4 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2024-01-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Under certain circumstances, the action attribute of the form just contains the hash target, but the url is missing and form is not working any more. The wrong form tag looks like this:

<form enctype="multipart/form-data" method="post" id="myform" action="#myform">

I've debugged it, starting from view helper "formvh:form", ending in PageLinkBuilder (https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php#L486), code part:

        if ($fragment
            && $useAbsoluteUrl === false
            && $currentSiteLanguage === $siteLanguageOfTargetPage
            && $targetPageId === (int)$tsfe->id
            && (empty($conf['addQueryString']) || !isset($conf['addQueryString.']))
            && !($tsfe->config['config']['baseURL'] ?? false)
            && count($queryParameters) === 1 // _language is always set
        ) {
            $uri = (new Uri())->withFragment($fragment);

Here, $uri gets value "#myform", because TYPO3 assumes the link targets to current page and is just an anchor link. That's valid, but not for forms.

To reproduce the problem, be sure that:

1) form view helper has "section" attribute set
2) form view helper has "addQueryString" attribute set to false
3) no base url is configured
4) no other query parameters are set (except language), not even controller action (that means, the target action of the form has to be the default controller action)

Problem also existing in TYPO3 v12, according to identical PHP code.

Actions

Also available in: Atom PDF