optgroup is not supported

Created on 25 March 2014, over 10 years ago
Updated 8 June 2023, over 1 year ago

I created a new list which outputs a select list with options grouped by optgroups.

Field label: Test
Field machine_name: field_test1

Field's options are listed correctly in the node add/edit forms.

But whenever the node is saved, the form returns an error: Test: illegal value.

Here is the code I use in my module:

function mymodule_list_option_info() {
  $info['trackssessions'] = array(
    'label' => t('ASCA Tracks & Sessions'),
    'callback' => 'mymodule_list_option_trackssessions',
  );

  return $info;
}

function mymodule_list_option_trackssessions() {
  return array(
    'Track 1' => array(
      0 => 'Session 1',
      1 => 'Session 2',
      2 => 'Session 3',
    ),
    'Track 2' => array(
      3 => 'Session 4',
      4 => 'Session 5',
    ),
    'Track 3' => array(
      5 => 'Session 6',
      6 => 'Session 7',
    ),
  );
}
🐛 Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

🇩🇰Denmark osman Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024