[TYPO3-dev] TCA Backend Input form Validation
Satish Maurya
satish04mca at gmail.com
Tue Dec 9 08:16:50 CET 2014
Hi All,
Could you please help following error in below code? this code I have
written in ext_localcong.php file and need to apply validation on TCA form
when updating the backend admin.
1. Below code display two error messages
2. After displaying the errors, data gets update into database. I need to
restrict db update if error display.
//------------------------------
if($table == 'tx_ce_featurerequest_data') {
if( $fieldArray['vote_start_date'] > $fieldArray['vote_end_date'] ) {
$message =
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
'Start date cannot be greater than End date.',
'Please correct following errors:',
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
\TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($message);
return false;
}
//--------------------
Could you please suggest anyting?
On Fri, Dec 5, 2014 at 7:53 PM, Satish Maurya <satish04mca at gmail.com> wrote:
> Thanks a lot Stephan. Got it.
>
> Is there any TYPO3 documentation link for the further reading about it?
>
> Thanks again.
> Satish
>
>
>
> On Fri, Dec 5, 2014 at 7:18 PM, Stephan Großberndt <
> s.grossberndt at sidebysite.de> wrote:
>
>> You need a hook in ext_localconf.php
>>
>> // Adds mobdb hooks to the tcemain
>> // "processDatamapClass" = new, update
>> // "processCmdmapClass" = move, copy, delete, undelete, localize,
>> version etc.
>> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.
>> t3lib_tcemain.php']['processDatamapClass'][] =
>> 'EXT:myext/Classes/Service/TceMainHooks.php:Tx_Myext_
>> Service_TceMainHooks';
>> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.
>> t3lib_tcemain.php']['processCmdmapClass'][] = 'EXT:myext/Classes/Service/
>> TceMainHooks.php:Tx_Myext_Service_TceMainHooks';
>>
>> which may implement certain methods
>>
>> myext/Classes/Service/TceMainHooks.php:
>>
>> class Tx_Myext_Service_TceMainHooks {
>>
>> /**
>> * This method is called by a hook in the TYPO3 Core Engine
>> (TCEmain) when a record is saved.
>> *
>> * @param array $fieldArray: The field names and
>> their values to be processed
>> * @param string $table: The table TCEmain is
>> currently processing
>> * @param string $id: The records id (if any)
>> * @param object $reference: Reference to the parent
>> object (TCEmain)
>> * @return void
>> * @access public
>> */
>> function processDatamap_preProcessFieldArray(&$fieldArray,
>> $table, $id, &$pObj) {
>>
>> if ($table == 'tx_myext_record' && !stristr($id, 'NEW')
>> && $fieldArray['status'] == 'under_review') {
>> // Send mail
>> }
>>
>> if ($table == 'tx_myext_record' &&
>> $fieldArray['starttime'] > $fieldArray['endtime']) {
>> $reference->log($table, $id, 2,
>> 0, 1, 'starttime > endtime');
>>
>> }
>> }
>>
>> }
>> _______________________________________________
>> TYPO3-dev mailing list
>> TYPO3-dev at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>>
>
>
>
> --
> *Thanks & regards,*
> Satish Maurya
>
>
--
*Thanks & regards,*
Satish Maurya
More information about the TYPO3-dev
mailing list