Results 1 to 3 of 3

Thread: DCA table field

  1. #1
    User
    Join Date
    05-21-18.
    Posts
    126

    Frage DCA table field

    In table with structure like this
    $GLOBALS['TL_DCA']['']['fields'][''] = array(
    'label' =>
    'exclude' => true,
    'inputType' => 'checkbox',
    'options_callback' => array(),
    'eval' => array(
    mandatory => true;,
    ),
    'save_callback' => array(),
    ),
    'sql' => '',
    );
    How can i change 'mandatory' field if some cases are fulfilled. Like if this is 1 mandatory is true or 0 then is false?
    Is possible to make some function to manage fields?
    Thanks

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    You have to format your code to see your errors:
    PHP Code:
    $GLOBALS['TL_DCA']['']['fields'][''] = array(
      
    'label' =>
      
    'exclude' => true,
      
    'inputType' => 'checkbox',
      
    'options_callback' => array(),
      
    'eval' => array(
        
    mandatory => true;,
      ),
      
    'save_callback' => array(),
    ),
      
    'sql' => '',
    ); 
    Corrected:
    PHP Code:
    $GLOBALS['TL_DCA']['TABLENAME']['fields']['FIELDNAME'] = array(
      
    'label'            => '',
      
    'exclude'          => true,
      
    'inputType'        => 'checkbox',
      
    'options_callback' => array(),
      
    'eval'             => array(
        
    'mandatory' => true
      
    ),
      
    'save_callback'    => array(),
      
    'sql'              => ''
    ); 
    To just change the mandatory setting you have to use this:
    PHP Code:
    $GLOBALS['TL_DCA']['TABLENAME']['fields']['FIELDNAME']['eval']['mandatory'] = true
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3
    User
    Join Date
    05-21-18.
    Posts
    126

    Cool Thanks

    I deleted fields properties because of privacy. Thanks, your help saved my day.
    Last edited by xchs; 06/02/2018 at 13:30.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •