[TYPO3-dev] TCA select - Insert NULL
Jigal van Hemert
jigal.van.hemert at typo3.org
Thu Apr 11 11:38:23 CEST 2013
Hi,
On 10-4-2013 9:38, Agash Thamo. wrote:
> I have made an extension for TYPO3 4.5 with extbase and fluid (i used
> Extension Builder). Now to insert some data, i use the backend module
> 'list', which generates some forms with the TCA of my table.
> Now to make a select box optional, i insert an item with the value NULL
> before the foreign table, like this:
>
> 'feuser' => array(
> 'exclude' => 0,
> 'label' =>
> 'LLL:EXT:yes/Resources/Private/Language/locallang_db.xml:tx_yes_domain_model_schools.feuser',
>
> 'config' => array(
> 'type' => 'select',
> 'items' => array(
> array('', NULL),
> ),
> 'foreign_table' => 'fe_users',
> 'maxitems' => 1,
> ),
> ),
>
> But it doesn't work. I get an SQL Error because of my relation (but NULL
> values are allowed). I also tried '', "" and 0. But those doesn't work
> either.
As you wrote that you use the List module to edit records only the
combination of TCA (+ settings in TSconfig) and the SQL are relevant.
Can you give the SQL error you see and the SQL definition of the feuser
field (from your ext_tables.sql)?
If you use 'items' and 'foreign_table' the items from the foreign_table
will be added to those in 'items'.
NULL values are not always handled correctly in 4.5, so depending on the
field definition you should use '' (empty string) or 0 (zero) for an
empty field.
--
Jigal van Hemert
TYPO3 CMS Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-dev
mailing list