Task #61934
closedForms: "current" and ".field" data is not visible
0%
Description
When using a FORM cObject, "current" value and "field" data is not visible inside the FORM object.
The following minimal code example illustrates the issue. Outside the FORM cObject, both {GP: test} and {field: test} are visible. However inside the FORM element, only {GP: test} is visible. Apparently this information is not passed on.
lib.testForm = COA lib.testForm { 20 = TEXT # This works. 20.data = GP : test 20.wrap = <p>GP: |</p> 30 = TEXT # And this works. 30.data = field : test 30.wrap = <p>Field: |</p> 40 = FORM 40 { 30 = TEXT # This also works. 30.data = GP : test 30.wrap = GP: | 40 = TEXT # This does not work. 40.data = field : test 40.wrap = Field: | } }
This is the output of above typoscript:
<p>GP:31</p> <p>Field:42</p> <form action="test/test.html" enctype="multipart/form-data" method="post"> <ol> <li class="csc-form-5 csc-form-element csc-form-element-content">GP:31</li> <li class="csc-form-6 csc-form-element csc-form-element-content">Field:</li> </ol> </form>
As far as I can tell, the issue is that start($data, $table)
is not called when creating the ContentObjectRenderer in \TYPO3\CMS\Form\Domain\Factory\TypoScriptFactory
.
protected function getLocalConentObject() { if (!isset($this->localContentObject)) { $this->localContentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $this->localContentObject.start($data, $table); // This line is missing. } return $this->localContentObject; }
The indicated statement is missing. However I don't know where $data
and $table
should come from.
Updated by Björn Jacob over 9 years ago
- Category changed from Form Framework to 1602
Updated by Björn Jacob over 9 years ago
- Category changed from 1602 to Form Framework
Updated by Björn Jacob over 9 years ago
- Tracker changed from Bug to Task
- Status changed from New to Needs Feedback
Franz, what could be the context/ scope of the query? You want to get the information stored inside the field "test". But to which table does this field belong to? pages, tt_content? IMHO this cannot work since there is no scope. But do you expect by using the field parameter?
Updated by Franz Geiger over 9 years ago
Uhm, unfortunately I'm not sure what I was up to a year ago. Neither do I remember where I tested this minimal example. The particular test installation is probably long gone.
Maybe it was supposed to access a field of the page record? Or maybe from the content object?
Updated by Alexander Opitz about 9 years ago
So I'd like to close this issue. You can open a new one, if you encounter the issue again. Is that ok for you?
Updated by Franz Geiger about 9 years ago
I still think it would be a worthwhile feature if one could create and/or pre-fill form fields dynamically. However I don't use built-in forms anymore (for this very reason among others) and thus don't care. I'm fine with you closing the issue.
Updated by Björn Jacob about 9 years ago
- Subject changed from "current" and ".field" data is not visible in FORM cObject to Forms: "current" and ".field" data is not visible
- Status changed from Needs Feedback to Closed
I've analyzed the issue. There are some things to know and take care of.
- Building the form with the wizard does not allow you to insert cObjects. In this context cObjects are not rendered in the frontend.
- Building the form with TypoScript outside of the wizard/ bodytext context cObjects are possible.
The following snippet works as expected:
lib.formPid5 = COA lib.formPid5 { 10 = FORM 10 { prefix = formPid5 class = formPid5 10 = FIELDSET 10 { 10 = TEXTLINE 10 { name = name label.value.data = LLL:EXT:reports/Resources/Private/Language/locallang.xlf:mlang_labels_tablabel } } 20 = TEXT 20.data = GP:test 20.wrap = <p>GP:|</p> 30 = CONTENT 30 { table = tt_content select { pidInList = 5 orderBy = sorting } } } }
Your above mentioned code is not working since the context is missing inside the form. You have to use a different cObject to render specific content stored in tables like pages or tt_content.
40 = TEXT # This does not work. 40.data = field : test 40.wrap = Field: |