I want to have a big Fluid form where multiple records can be modified at once. There is only one form on the page to submit all records.
<f:if condition="{records}">
<f:then>
<f:form action="update" enctype="multipart/form-data" name="updateRecords" object="{records}">
<div class="row">
<f:for each="{records}" as="element" iteration="recordsIterator">
<div class="col-md-3">
<h5>{element.title}</h5>
<div>
<f:if condition="{feature}">
<f:then>
<h6>
<f:translate key="records.feature" />
</h6>
<f:form.checkbox property="feature" value="2" />
<label for="tx_example_records[updateRecords][{recordsIterator.index}][feature]">
<f:translate key="records.read" />
</label>
</f:then>
</f:if>
</div>
</div>
</f:for>
</div>
<f:form.submit class="button" value="{f:translate(key: 'submit', default: '[submit]')}"><input class="button" type="submit" name="" value="Submit" /></f:form.submit>
</f:form>
</f:if>
The corresponding controller has only a domain object as parameter.
/**
* action update
*
* @param \Foo\Example\Domain\Model\Records $updateRecords
* @return void
*/
public function updateAction(\Foo\Example\Domain\Model\Records $updateRecords) : void
However I need a solution with an array of all listed Domain\Model\Records
passed as a parameter from the submitted form to the updateAction
. The attribute feature
is a checkbox to be checked if the record's value of feature = '2';
. Is this somehow possible in TYPO3? Or must I use some tricks to accomplish this task?
You can go with a Data Transfer Object here, holding the values you need to submit the form. You can find some general information related to Extbase here: https://usetypo3.com/dtos-in-extbase.html