Bug #90083

Updated by Ralf Zimmermann 12 days ago

There are scenarios in which the same form is rendered several times even though it is only output once on the page.
Assuming there is a form plugin with a form with validators on form elements on colPos 10, the following setup would render the plugin twice and output the second rendered plugin.

setup.typoscript

<pre><code class="text">
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:site_package/Resources/Private/Templates/Index.html

variables {
content-col-10 < styles.content.get
content-col-10.select.where = colPos=10
}
}
}

lib.getSomeColPos = CONTENT
lib.getSomeColPos {
table = tt_content
select.where = colPos=10
select.orderBy = sorting
}
</code></pre>

EXT:site_package/Resources/Private/Templates/Index.html

<pre><code class="html">
<f:cObject typoscriptObjectPath="lib.getSomeColPos"/>
</code></pre>

The result is that the validators are missing in the 2nd rendered form.
This is because when the validators are added, a runtime cache is used to prevent validators from being added twice (needed due to internal processes). twice.
When rendering the same 2. form no more validators are added because the form element is not identified clearly enough.

A simple test to fake such a scenario without much effort would be:

setup.typoscript

<pre><code class="text">
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:site_package/Resources/Private/Templates/Index.html

variables {
content < styles.content.get
content-foo < styles.content.get
}
}
}
</code></pre>

EXT:site_package/Resources/Private/Templates/Index.html

<pre><code class="html">
{content-foo -> f:format.raw()}
</code></pre>

or

setup.typoscript

<pre><code class="text">
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:site_package/Resources/Private/Templates/CustomContentElement.html
settings {
persistenceIdentifier = 1:/form_definitions/test.form.yaml
}
extbase.pluginName = Form
extbase.controllerExtensionName = Formframework
extbase.controllerName = FormFrontend
extbase.controllerActionName = perform
}
}
</code></pre>

EXT:site_package/Resources/Private/Templates/CustomContentElement.html

<pre><code class="html">
<formvh:render persistenceIdentifier="{settings.persistenceIdentifier}" />
<formvh:render persistenceIdentifier="{settings.persistenceIdentifier}" />
</code></pre>

1:/form_definitions/test.form.yaml

<pre><code class="yaml">
type: Form
identifier: test
label: test
prototypeName: standard
renderables:
-
type: Page
identifier: page-1
label: Step
renderables:
-
defaultValue: ''
type: Text
identifier: text-1
label: Text 1
-
defaultValue: ''
type: Text
identifier: text-2
label: Text 2
properties:
fluidAdditionalAttributes:
required: required
validators:
-
identifier: NotEmpty
-
defaultValue: ''
type: Text
identifier: text-3
label: Text 3
properties:
fluidAdditionalAttributes:
required: required
validators:
-
identifier: NotEmpty
-
type: SummaryPage
identifier: summarypage-1
label: 'Summary step'
</code></pre>

result:

!validators.png!

Back