[TYPO3-dev] STOP saving TCA form data using function processDatamap_preProcessFieldArray validation
Satish Maurya
satish04mca at gmail.com
Wed Dec 17 13:28:52 CET 2014
Thanks Stephan !!!
but the way it was not accepted by the client.
I have applied date selector validation, here is the way to do it. now, not
require any validation.
'vote_start_date' => array(
'label' => 'Voting Start Date',
'config' => array(
'type' => 'input',
'size' => 15,
'eval' => 'date',
'range' => array(
'lower' => mktime(0,0,0,date('m'), date('d'), date('Y'))
)
)
),
'vote_end_date' => array(
'label' => 'Voting End Date',
'config' => array(
'type' => 'input',
'size' => 15,
'eval' => 'date',
'range' => array(
'lower' => mktime(0,0,0,date('m'), date('d'), date('Y'))
)
)
),
Thanks
Satish
On Tue, Dec 16, 2014 at 11:30 PM, Stephan Großberndt <
s.grossberndt at sidebysite.de> wrote:
>
> 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
>>
>>
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>
--
*Thanks & regards,*
Satish Maurya
More information about the TYPO3-dev
mailing list