[TYPO3-german] mehrere Objekte einer Klasse aus einem Formular speichern

Stefan Padberg post at bergische-webschmiede.de
Wed Oct 12 14:16:24 CEST 2016


Wie sieht der erzeuget HTML-Code aus?

BG
Stefan

Am 12.10.2016 um 13:25 schrieb Christof Schmidt:
> Hallo
> Ich bin ziemlich neu bei typo3 und stehe gerade total auf dem Schlauch.
> Ich möchte mehrere Einträge aus einem Formular aus einer
> foreach-Schleife speichern.
> 
> [code]
> <h1>{headline}</h1>
> 
> <f:render partial="Error" arguments="{object:'timeofday'}" />
> <h3>{survey.title}</h3>
> 
> <f:form action="{action}" object="{timeofday}" name="timeofday"
> arguments="{survey:survey, appiontment:appiontment}"
> additionalAttributes="{role:'form'}">
> 
> <f:for each="{survey.appiontments}" as="appiontments">
> <li class="list-group-item">
> <label>{appiontments.appiontmentdate}</label>
> <f:form.textfield property="timevalue" type="time" class="form-control"
> id="{appiontments}" />
> </li>
> 
> </f:for>
> 
> <f:form.submit value="{submitmessage}" class="btn btn-primary" />
> 
> </f:form>
> 
> [/code]
> 
> 
> Mein aktueller Controller speichert jetzt natürlich nur den letzten Wert.
> Ich komme aber einfach nicht drauf wie ich jetzt weiter verfahre.
> 
> 
> [code]
> /**
> * @param \Schmidtch\Survey\Domain\Model\Survey $survey
> * @param \Schmidtch\Survey\Domain\Model\Appiontment $appiontment
> * @param \Schmidtch\Survey\Domain\Model\Timeofday $timeofday
> */
> public function addAction(
> \Schmidtch\Survey\Domain\Model\Survey $survey,
> \Schmidtch\Survey\Domain\Model\Appiontment $appiontment,
> \Schmidtch\Survey\Domain\Model\Timeofday $timeofday) {   
> $appiontment->addTimeofday($timeofday);   
> $this->objectManager->get('Schmidtch\\Survey\\Domain\\Repository\\AppiontmentRepository')->update($appiontment);
> 
> $this->redirect('show','Survey',Null,array('survey'=>$survey));
> }
> [/code]


-- 
Bergische Webschmiede
Dipl.-Ing. Stefan Padberg
TYPO3-Integrator und Webprogrammierer
:: Borner Str. 18 - 42349 Wuppertal
:: +49 202 97648355
:: +49 173 9219845
:: post at bergische-webschmiede.de
:: http://www.bergische-webschmiede.de


More information about the TYPO3-german mailing list