tritum/repeatable_form_elements

repeatable elements not available for SaveToDatabaseFinisher

johfeu opened this issue · 5 comments

johfeu commented

Even though the Readme states "All form finishers will be aware of the copied field(s)." it seems not to be possible to save fields from repeatable fields even with repeatablecontainer-1.0.imageupload-1: keys.
Maybe related to #29 ?

SaveToDatabaseFinisher uses $this->finisherContext->getFormValues() which takes the values from formRuntime->getFormState()->getFormValues(); Those seem not to be touched by repeatable_form_elements

Hi @johfeu,

I didn't use it myself yet (will probably have to in the near future), but you could try this extension: https://github.com/EcoGabe/em_form_repeatablesave

FYI: I have now been able to test the extension. Basically it works - although I had to remove the check whether a mapped value is a string... (here)

However, in my case I have the problem that I'm using the form to update an existing record and the WHERE clause is based on a value to be entered in a field within the repeatable container. Does anyone know if there is a way to evaluate the WHERE clause accordingly? @tritum?

@Hawkeye1909
Thank you for your patience and the recommendation to https://github.com/EcoGabe/em_form_repeatablesave from Extrameile.

I'll have a look here to see how all this could be used together.

@Hawkeye1909 @johfeu
I added an similar approach to the mentioned Repo inside this extension as I see, this can become a regular requested feature and should be adapted to code changes in the extension.
Maybe you can try this codebase (#44 ) for your scenario?

@chrosey I tried #44 with an edited version of my original form.
Inside the repeatable container is a GridRow element ("kidsData"). When submitting, the follwing error/warning occurs:
PHP Warning: Undefined array key "kidsData" in /[pathToSite]/public/typo3conf/ext/repeatable_form_elements/Classes/Finisher/SaveToDatabaseFinisher.php line 182...
If I add the fields outside the GridRow, the data is saved.
The same occurs when I try to save data from fields inside a GridRow that is outside the repeatable container.

Tested with TYPO3 v11.5.38, if that matters.