[TYPO3-dev] STOP saving TCA form data using function processDatamap_preProcessFieldArray validation

Stephan Großberndt s.grossberndt at sidebysite.de
Tue Dec 16 19:00:11 CET 2014


As I already answered on 9.12.2014 in "Re: [TYPO3-dev] TCA Backend Input 
form Validation" <mailman.11267.1418109444.685.typo3-dev at lists.typo3.org>:

$fieldArray is given as a reference. So probably the best option is to

unset($fieldArray['vote_start_date']); unset($fieldArray['vote_end_date']);

You could also completely unset $fieldArray, but in that case all other 
information entered would be lost. Unsetting 
$fieldArray['vote_start_date'] will result in no change to the record 
while setting $fieldArray['vote_start_date'] = 0; in clearing the 
vote_start_date.

Am 16.12.2014 um 12:12 schrieb Satish Maurya:
> Hi All,
>
> I have validated start and end date using below function but the data gets
> saved into DB.
>
> function processDatamap_preProcessFieldArray(&$fieldArray, $table, $id,
> &$pObj) {
>
> global $TYPO3_DB, $TCA;
>
> if($table == 'tx_ce_featurerequest_data') {
> if( $fieldArray['vote_end_date'] < $fieldArray['vote_start_date'] ) {
> $pObj->log('tx_ce_featurerequest_data', 2, $id, 0, 1, "Voting end
> (".t3lib_BEfunc::date($fieldArray['vote_end_date']).") is earlier than
> Voting start
> date(".t3lib_BEfunc::date($fieldArray['vote_start_date']).").", 1);
> }
>
> Is there any way to stop saving data if error occurred?
>
>
> *Thanks*
> Satish
>




More information about the TYPO3-dev mailing list