[TYPO3-project-formidable] How to update an existing record?
Uwe Schmelzer
us at planungsgruppeinternet.de
Thu Jul 30 11:35:03 CEST 2009
Oh! I've just found it!
Posting helps ;)
1. This one does the trick:
<editEntry>54</editEntry>
2. Complete code:
<datahandler:DB>
<tablename>fe_users</tablename>
<keyname>uid</keyname>
<editEntry>54</editEntry>
<process>
<!-- Set some values to update an existing record -->
<beforeEdition>
<userobj>
<php><![CDATA[/*<?*/
$aData = $this->getUserObjParams();
$aData['disable' ] = 1;
$aData['tstamp'] = time();
return $aData;
/*?>*/]]></php>
</userobj>
</beforeEdition>
</process>
</datahandler:DB>
Cheers Uwe
--
Herzliche Grüsse aus Sindelfingen
Uwe Schmelzer
us at planungsgruppeinternet.de
Planungsgruppe Internet
Parkstrasse 20
71063 Sindelfingen
Tel. 07031 / 704 089
Fax: 01805 / 233 633-00745
Uwe Schmelzer schrieb:
> Hi List,
> how do I update an existing record?
>
> 1. I know how to do it the classic way, as described here:
> http://formidable.typo3.ug/reference/control/datahandlerdb.html
>
> This datahandler works by default in CREATION mode. [...]
> To make it work in EDITION mode, when invoking Formidable, give the uid
> of the record you need to edit as the third parameter.
>
>
> 2. My Question:
> Is there an alternative way to do it?
>
> Example:
> My code to deactivate a feuser just keeps inserting new records,
> instead of updating the record for the fe user with the uid = 54.
>
> <datahandler:DB>
> <tablename>fe_users</tablename>
> <keyname>uid</keyname>
> <process>
> <beforeEdition>
> <userobj>
> <php><![CDATA[/*<?*/
>
> /* SOME COMMAND HERE TO SWITCH datahandler:DB into EDITION Mode */
> /* e.g.: $this->oForm->oDataHandler->SWITCH_TO_EDITION_MODE();
>
> /* SET VALUES TO BE UPDATED FOR AN EXISTING RECORD */
> $aData = $this->getUserObjParams();
> $aData['uid' ] = 54;
> $aData['disable' ] = 1;
> /*?>*/]]></php>
> </userobj>
> </beforeEdition>
> </process>
> </datahandler:DB>
>
>
>
>
> Cheers Uwe
>
More information about the TYPO3-project-formidable
mailing list