[TYPO3-german] mehrere Objekte einer Klasse aus einem Formular speichern
Stefan Padberg
post at bergische-webschmiede.de
Thu Oct 13 09:08:31 CEST 2016
Mir fällt auf, dass der HTML-Code in den li-Tags identisch ist. Das
Formular kann so nicht funktionieren.
Gruß
Stefan
Am 13.10.2016 um 08:30 schrieb Christof Schmidt:
> Das dazugehörige Template sieht jetzt so aus
>
> <f:layout name="Default" />
>
> <f:section name="content">
>
> <h1>Termin wählen</h1>
>
> <f:render partial="Error" arguments="{object:'timeofday'}" />
> <h3>{survey.title}</h3>
>
> <f:form action="add" method="post" object="{timeofday}"
> name="timeofday" controller="Timeofday" arguments="{survey:survey}"
> additionalAttributes="{role:'form'}">
>
> <f:for each="{survey.appiontments}" as="appiontments" >
> <li class="list-group-item">
> <label>{appiontments.appiontmentdate}</label>
> <f:form.textfield type="time" class="form-control"
> name="timeofdays[timevalue1][]" value="00:00" />
> <f:form.textfield type="time" class="form-control"
> name="timeofdays[timevalue2][]" value="00:00" />
> <f:form.textfield type="time" class="form-control"
> name="timeofdays[timevalue3][]" value="00:00" />
> <f:form.hidden class="form-control"
> name="timeofdays[appiontmentID][]" value="{appiontments.uid}" />
> </li>
>
> </f:for>
>
> <f:form.submit value="Umfrage erstellen" class="btn btn-primary" />
>
> </f:form>
>
> </f:section>
>
>
> und der HTML-Code dazu
> <form role="form" method="post" name="timeofday"
> action="index.php?id=62&tx_survey_surveylisting%5Bsurvey%5D=39&tx_survey_surveylisting%5Baction%5D=add&tx_survey_surveylisting%5Bcontroller%5D=Timeofday&cHash=8fd44f177958c3ffa955c95c19f283f8">
>
> <div>
> <input type="hidden"
> name="tx_survey_surveylisting[__referrer][@extension]" value="Survey" />
> <input type="hidden" name="tx_survey_surveylisting[__referrer][@vendor]"
> value="Schmidtch" />
> <input type="hidden"
> name="tx_survey_surveylisting[__referrer][@controller]"
> value="Timeofday" />
> <input type="hidden" name="tx_survey_surveylisting[__referrer][@action]"
> value="addFormTime" />
> <input type="hidden"
> name="tx_survey_surveylisting[__referrer][arguments]"
> value="YTozOntzOjY6InN1cnZleSI7czoyOiIzOSI7czo2OiJhY3Rpb24iO3M6MTE6ImFkZEZvcm1UaW1lIjtzOjEwOiJjb250cm9sbGVyIjtzOjk6IlRpbWVvZmRheSI7fQ==34f5438732efaab1e2d0207be261f6bbba0260c6"
> />
> <input type="hidden"
> name="tx_survey_surveylisting[__referrer][@request]"
> value="a:4:{s:10:"@extension";s:6:"Survey";s:11:"@controller";s:9:"Timeofday";s:7:"@action";s:11:"addFormTime";s:7:"@vendor";s:9:"Schmidtch";}5f3f3d72291afe52f3a3b4104f05fda6ef060316"
> />
> <input type="hidden" name="tx_survey_surveylisting[__trustedProperties]"
> value="a:1:{s:10:"timeofdays";a:4:{s:10:"timevalue1";a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}s:10:"timevalue2";a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}s:10:"timevalue3";a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}s:13:"appiontmentID";a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}}}f221468d4cef250545cb23270b94a46163a625bc"
> />
> </div>
>
>
>
> <li class="list-group-item">
> <label>2016-10-20</label>
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue1][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue2][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue3][]" value="00:00" />
> <input class="form-control" type="hidden"
> name="tx_survey_surveylisting[timeofdays][appiontmentID][]" value="9" />
> </li>
>
>
> <li class="list-group-item">
> <label>2016-11-15</label>
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue1][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue2][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue3][]" value="00:00" />
> <input class="form-control" type="hidden"
> name="tx_survey_surveylisting[timeofdays][appiontmentID][]" value="10" />
> </li>
>
>
> <li class="list-group-item">
> <label>2016-11-30</label>
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue1][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue2][]" value="00:00" />
> <input class="form-control" type="time"
> name="tx_survey_surveylisting[timeofdays][timevalue3][]" value="00:00" />
> <input class="form-control" type="hidden"
> name="tx_survey_surveylisting[timeofdays][appiontmentID][]" value="11" />
> </li>
>
>
>
> <input class="btn btn-primary" type="submit" value="Umfrage
> erstellen" />
>
> </form>
>
> Ich frage mich auch, warum im HTML-Code "tx_survey_surveylisting" im
> name automatisch gesetzt wird und ich deshalb bei $_POST oder $arguments
> = $this->request->getArguments(); keine Argumente bekomme.
> Habe bisher ausprobiert
>
> $arguments = $this->request->getArguments();
> $timeofdays = $arguments['tx_survey_surveylisting']['timeofdays'];
> oder
> $arguments = $this->request->getArguments();
> $timeofdays = $arguments['timeofdays'];
>
> die foreach schleife
> foreach ($timeofdays['appiontmentId'] as $appiontment)
> ist dann leider leer
>
>
>
--
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