#91419Disable caching on a per form basis
Description
The form framework caches forms which causes issues when pre-filling fields with data. Any dynamic data retrieved via get params or database queries will be cached and can’t be overridden until caches are deleted.
Current solutions found in the typo3 slack channel fx. include disabling caching completely for the render function in the form controller:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Form']['plugins']['Formframework']['controllers'][\TYPO3\CMS\Form\Controller\FormFrontendController::class]['nonCacheableActions'][] = 'render';
This of course changes caching for all forms which is not really an ideal solution.
Another solution suggested was using USER_INT instead of USER like this:
tt_content.form_formframework.20 = USER_INT
This would allow for disabling the cache on a per page basis. However certain forms which need to be uncached may be inserted by editors on multiple pages and makes it necessary to keep track of page ids where such forms are present and add them to our Typoscript.
It would be great to be able to disable caches for certain form configurations, perhaps as a yaml property. I am not sure if caches could be easily disabled via the form api in hooks where dynamic data is added, if this is the case that would also work for me.
Reviews 2
Related issues 2
History 1519
-
Björn Jacob commented and changed status
NewClosed <span data-processor="relativetime" data-value="2021-08-13T16:05:19+00:00" > 08/13/21, 16:05 </span>Thanks for your contribution :) We are working on a solution which will also be available for v10. Please see #93887 and #92406 / https://review.typo3.org/c/Packages/TYPO3.CMS/+/70460/. I am closing this issue since the patch will fix your problem.
-
Björn Jacob changed Related to #93887 <span data-processor="relativetime" data-value="2021-08-13T16:05:28+00:00" > 08/13/21, 16:05 </span>
-
Björn Jacob changed Related to #92406 <span data-processor="relativetime" data-value="2021-08-13T16:05:33+00:00" > 08/13/21, 16:05 </span>
-
Björn Jacob changed Sprint Focus Remote Sprint <span data-processor="relativetime" data-value="2021-08-13T16:06:43+00:00" > 08/13/21, 16:06 </span>
-
Gerrit Code Review pushed patch set 13 for master to change 70460 status
ClosedUnder Review <span data-processor="relativetime" data-value="2021-08-13T17:19:25+00:00" > 08/13/21, 17:19 </span> -
Gerrit Code Review pushed patch set 14 for master to change 70460 <span data-processor="relativetime" data-value="2021-08-13T18:07:09+00:00" > 08/13/21, 18:07 </span>
-
Gerrit Code Review pushed patch set 1 for master to change 70587 <span data-processor="relativetime" data-value="2021-08-13T19:52:05+00:00" > 08/13/21, 19:52 </span>
-
Simon Schaufelberger commented and changed subject
Disable caching on a per form basis.Disable caching on a per form basis <span data-processor="relativetime" data-value="2021-10-28T21:50:32+00:00" > 10/28/21, 21:50 </span>I’m also affected by this bug as I have a prefill typoscript config when logged in with data from fe_user.
-
Simon Schaufelberger changed description <span data-processor="relativetime" data-value="2021-10-28T22:17:10+00:00" > 10/28/21, 22:17 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 70587 <span data-processor="relativetime" data-value="2021-11-29T13:25:11+00:00" > 11/29/21, 13:25 </span>
-
Tim Obert commented <span data-processor="relativetime" data-value="2022-06-29T14:10:49+00:00" > 06/29/22, 14:10 </span>
Any news here?
It seems that the patch is not compatible to the current state of the repo anymore and the workaround with “TYPO3_CONF_VARS” also doesn’t seem to help. -
Björn Jacob commented <span data-processor="relativetime" data-value="2022-06-29T15:17:51+00:00" > 06/29/22, 15:17 </span>
We are still working on this issue. ATM there is another core sprint. The changes are rather complex.
-
Alexander Grein commented <span data-processor="relativetime" data-value="2023-08-04T09:33:20+00:00" > 08/04/23, 09:33 </span>
The workaround to set `tt_content.form_formframework.20 = USER_INT` is not working under TYPO3 12, since it uses an EXTBASEPLUGIN content object now.
Disabling caching for all forms, feels very crude.
-
Jarvis H commented <span data-processor="relativetime" data-value="2024-02-21T12:45:16+00:00" > 02/21/24, 12:45 </span>
Any news here after (checks calendar) 4 years?
-
André Buchmann commented <span data-processor="relativetime" data-value="2024-08-20T13:47:00+00:00" > 08/20/24, 13:47 </span>
Due to the switch from USER to EXTBASEPLUGIN the simple switch to USER_INT is not working anymore directly as Alexander Grein already stated.
For TYPO3 12 & 13 you need to add the userFunc definition back in to get it working:
tt_content.form_formframework.20 = USER_INT tt_content.form_formframework.20.userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
Still this is only a workaround and I would like to have a feature to disable the cache for a single form/form element. Here is my usecase:
Customers get indiviualized links to a form. The GET param is automatically prefilled in a field.
Custom typoscript only on the special form page to read the GET param (?foo=bar). The GET param is excluded from the chash generation ([FE][cacheHash][excludedParameters])plugin.tx_form.settings { formDefinitionOverrides { // form identifier: test { renderables { // identifier: page-1 0 { renderables { // identifier: text-1 0 { defaultValue = TEXT defaultValue.data = gp:foo } } } } } } } // Disable caching for the form tt_content.form_formframework.20 = USER_INT tt_content.form_formframework.20.userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->runWhen the cache is enabled the first param value is cached for all other calls. Can’t have that for the personlized codes in my project :-)
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-08-20T17:09:34+00:00" > 08/20/24, 17:09 </span>
Don’t hit me, but how about utilizing JavaScript to read the GET params and fill specific fields?
Then everything could be cached and you wouldn’t need that custom form typoscript reading values…?
-
Simon Schaufelberger commented <span data-processor="relativetime" data-value="2024-08-20T20:00:32+00:00" > 08/20/24, 20:00 </span>
For me that JavaScript solution wouldn’t work. I’m reading values from the feusers table and fill it in
-
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-10-31T10:37:23+00:00" > 10/31/25, 10:37 </span>
I just tried following and it works:
tt_content.form_formframework.20 = COA_INT tt_content.form_formframework.20 { 10 = EXTBASEPLUGIN 10 { extensionName = Form pluginName = Formframework } }On core side I think of EXTBASEPLUGIN_INT
Any news here? Iam on 10.4 building some forms that do prefilling by current fe_user?