Zum Inhalt springen

Mit einem Formular in 2 Tabellen schreiben

Erstellt am 4. September 2012 · 1 Antwort · letzte Antwort am 4. September 2012

Tags: Fluid, Frage

mimaxx ·

Hallo,

wie kann man aus einem Formular in 2 Tabellen schreiben. Habe eine Tabelle für Checklisten und eine für alle Werte der Checklist. Diese werden je nach Checkliste dynamisch in das Formular geschrieben, da jede Checkliste andere Optionen haben kann.

im Template habe ich dem property noch newCheckOptions als neues Array angegeben.
-----------------------------------

<f:form action="create"  enctype="multipart/form-data"  name="newChecks" object="{newChecks}">

...

    <f:for each="{checklists.options}" as="options_value">
        <f:if condition="{options_value.type} == 0">
            {options_value.title}: <f:form.textfield name="newCheckOptions[valueCheck]" property="newCheckOptions[valueCheck]" id="valueCheck" value="" /> <br />
        </f:if>

im Controller
--------------

	protected function initializeAction() {
...
                    $this->checkOptionsRepository =& t3lib_div::makeInstance('Tx_MyExt_Domain_Repository_CheckOptionsRepository');
	}

public function createAction(Tx_MyExt_Domain_Model_Checks $newChecks, Tx_MyExt_Domain_Model_CheckOptions $newCheckOptions) {

...
$this->checksRepository->add($newChecks);
$this->checkOptionsRepository->add($newCheckOptions);

Es kommt beim Speichern folgender Fehler: #1255082824: Request hash (HMAC) checking failed. The parameter __hmac was invalid or not set, and objects were modified

Welche Ansätze gibt es sonst noch beim Speichern über zwei Tabellen?

Gruß
mimaxx

mimaxx ·

So wieder ein Stück weiter. In der Form muss property raus nur name="newCheckOptions[valueCheck]". Jetzt schreibt er in 2 Tabellen!

Gruß
mimaxx