Task #82615
closed
EXT:form - Add more explanations about the initializeFormElement hook into the docs.
Added by Juan Manuel Vergés Solanas about 7 years ago.
Updated about 6 years ago.
Description
When you use the BE module and you save a form default Value is set to ''
Then if you have some hook pre populating some field is having no effect as defaultValue: '' from Yaml file is having more priority.
I would like to think the way to fix it is not set defaultValue if it is empty, however I don't know which other implications could have.
hook function I'm using is
public function initializeFormElement(\TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface $renderable)
- Category set to Form Framework
- Status changed from New to Needs Feedback
- Assignee set to Juan Manuel Vergés Solanas
Can you provide your code from the Hook and the formDefinition yaml (please anonymize it)?
Actually this should work.
public function initializeFormElement(\TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface $renderable)
{
if ($renderable->getUniqueIdentifier() === 'something-else') {
$renderable->setDefaultValue('foo');
}
}
renderingOptions:
submitButtonLabel: Submit
addQueryString: 'true'
type: Form
identifier: something
label: Something
prototypeName: standard
renderables:
-
renderingOptions:
previousButtonLabel: 'previous Step'
nextButtonLabel: 'next Step'
type: Page
identifier: page-1
label: ''
renderables:
-
defaultValue: ''
type: Hidden
identifier: else
label: 'Else'
- Assignee changed from Juan Manuel Vergés Solanas to Ralf Zimmermann
- Status changed from Needs Feedback to Under Review
- Tracker changed from Bug to Task
- Subject changed from ext:form defaultValue: '' and hook initializeFormElement for pre populating to EXT:form - Add more explanations about the initializeFormElement hook into the docs.
- Status changed from Under Review to Needs Feedback
- Status changed from Needs Feedback to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF