Bug #76979
closed
FormEngine should allow to set default-Values in new CType-Elements
Added by Nicolai Schirawski over 8 years ago.
Updated about 6 years ago.
Category:
FormEngine aka TCEforms
Description
Create a new content-Element as Extension myext with ctype=myctype
In typo3conf/ext/myext/Configuration/TCA/Overrides/tt_content.php you can choose the Form-Elements being shown with CE "myctype" by setting
$GLOBALS['TCA']['tt_content']['types']['myctype']['showitem'] to the
Changing the behaviour of single form elements is only partly possible:
$GLOBALS['TCA']['tt_content']['types']['myctype'] = [
'columnsOverrides' => [
'imageheight' => [
'config' => [
'default' => 250,
'max' => 6,
]
],
Here, "max" will have an effect when using the field in BE, "default" will have no effect
Hey, thanks for report.
that's a chicken egg problem: for new records, type is not defined yet, so columnsOverrides can't be used, so you can't set default values in columnsOverrides.
Will close as rejected if you don't have a great idea on how do solve that without hacks.
btw: you could hand over the ctype as get or post (the new content element wizard does stuff like that). in this case the columnsOverrides will work if i remember correctly.
- Status changed from New to Needs Feedback
But strange: the max value can be changed with columnsOverrides. So this part works
And I am overwriting existing fields in tt_content...
So I think overwriting default should work, too.
- Subject changed from FromEngine should allow to set default-Values in new CType-Elements to FormEngine should allow to set default-Values in new CType-Elements
- Status changed from Needs Feedback to New
Confirmed for TYPO3 8.7.3
that's a chicken egg problem: for new records, type is not defined yet, so columnsOverrides can't be used, so you can't set default values in columnsOverrides.
This works for eval, placeholder, etc. before saving the new element.
- Status changed from New to Rejected
Hey. I'll have to close this. 'default' is set before type is calculated (because type can be influenced by default). So there really is a chicken-egg problem and setting 'default' in columnsOverride will not work in the forseable future.
Also available in: Atom
PDF