How to add blank value in the starting of the selection box in tca file (tca.php)


You can add a blank value in the beginning of the selection box (tca file – tca.php).

Add below code in tca file (tca.php) for add blank value in the starting of the selection box .

'items' => array (
        array('',0),
    ),

For Selection box in tca file (tca.php)

'companyList' => array (		
   'exclude' => 0,		
   'label' => 'LLL:EXT:EXTENSION_NAME/locallang_db.xml:
                          tx_jsproduct_product.company_id',		
   'config' => array (
      'type' => 'select',	
         'items' => array (
            array('',0),
         ),
      'foreign_table' => 'TABLE_NAME',	
      'foreign_table_where' => 'ORDER BY TABLE_NAME.uid',	
      'size' => 1,	
      'minitems' => 0,
      'maxitems' => 1,
   )
),

If you have any query then feel free to contact me at Jainish Senjaliya

Advertisements

4 thoughts on “How to add blank value in the starting of the selection box in tca file (tca.php)

  1. Hi, I want to go a step further… How do you validate that the selected option is not the blank one? For example the user missed to select a “valid” option and left the selector in blank.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s