[TYPO3-project-formidable] Changing data before saving
Jerome Schneider
j.schneider at ameos.com
Mon Dec 4 08:56:17 CET 2006
Hi Radu & Oliver :)
This is exactly what you need, indeed !
There is an alternate syntax for the userobj tags:
<process>
<beforeinsertion>
<userobj>
<php><![CDATA[
$aParams = func_get_args();
$aParams[1]["myfield"]= str_replace(",", ".",
$aParams[1]["myfield"]);
return $aParams[1];
]]></php>
</userobj>
</beforeinsertion>
</process>
Bye bye :)
Jerome
Radu Cocieru a écrit :
> Hi Oliver
>
> The DB datahandler has the tags
> <process>
> <beforeinsertion>
> <extension>this</extension>
> <method>Method</method>
> ....
>
> have a look at the
> ameos_formidable/api/class.maindatahandler.php
>
> _processBeforeInsertion method
>
> For more details.
>
> Regrads
>
> Oliver Klee wrote:
>> Hi all,
>>
>> using formidable 0.5.0 plus the REG validator, I have a text renderlet
>> which looks like this:
>>
>> <renderlet:TEXT name="price_regular">
>> <label>LLL:EXT:seminars/locallang_db.php:tx_seminars_seminars.price_regular</label>
>>
>> <validators>
>> <validator:PREG>
>> <pattern>
>> <value>/^[\d]*((\.|,)[\d]{1,2})?$/</value>
>>
>> <message>LLL:EXT:seminars/pi1/locallang.php:message_noPriceNumber</message>
>>
>> </pattern>
>> </validator:PREG>
>> </validators>
>> </renderlet:TEXT>
>>
>> As decimals can only be saved using "." as the decimal point, I'd like
>> to change all "," to "." before saving the data (e.g. using
>> preg_replace).
>>
>> How can I change the value before saving it to DB?
>>
>> Thanks a lot in advance,
>>
>>
>> Oliver
More information about the TYPO3-project-formidable
mailing list