Adjusting Form Output - presetName

Hey,

I want to change the output of a Contat-Form. I have created a custom Preset, changed the Form Element Template,… but I don’t know where I have to change the the form:render ViewHelper to the custom Preset I created. Hope someone can help me.

Thanks, David

Hi David,

if Flow:

{namespace form=TYPO3\Form\ViewHelpers}
<form:render factoryClass="Your\Package\YourFactory" presetName="yourPreset" />

Hey @bwaidelich,

Maybe I am missunderstanding but I just want to change the template for the singelinetext.html in a mailform. Shold I put this on top of my new template in my own package?

Because how should Neos know then about the new template if I define the Preset in my new file? I understand why I have to do this but not exactly where I should do it for the TYPO3.Form Application.

I change it like explained in the following Link:

Under the Headline:
“Creating a Custom Preset” and “Adjusting a Form Element Template”

But where should I do the following changes:

You now created a sub preset named myCustom which behaves exactly the same as the default preset. If you now specify the preset name inside the <form:render> ViewHelper you will not see any differences yet:

 <form:render factoryClass="..." presetName="myCustom" />

Or do I have to do some more changes?

Hi,

so, to change the template for a single form element type, you can exactly follow the instructions:

Register your custom preset like:

TYPO3:
  Form:
    presets:
      'yourPreset':
        parentPreset: 'default'
        formElementTypes:
          'TYPO3.Form:SingleLineText':
            renderingOptions:
              templatePathPattern: 'resource://Your.Package/Private/CustomElements/SingleLineText.html'

If you then want to use that preset in your Neos form, you can set it via TypoScript:

prototype(TYPO3.Neos.NodeTypes:Form) {
	presetName = 'yourPreset'
}

(see the Neos.Demo site package for reference)

1 Like

Hey,

That was exactly what I’m looking for. Now it is working. Thanks.