I get the following erros on selecting the selectbox. Here onchang of this field will populate another checkbox with city details id zipcode using ajax callback.
$zipcode_options = get_all_zipcodes_ascending();
// Populate Ort on auktion clone.
$selected = isset($auktion->zip_code) ? $auktion->zip_code : NULL;
$selected = isset($form_state['values']['zip_code']) ? $form_state['values']['zip_code'] : $selected;
$ort_options = _ajax_city_dropdown_options($selected);
$form['zip_code'] = [
'#type' => 'select',
'#title' => t('PLZ'),
'#options' => $zipcode_options,
'#default_value' => isset($auktion->zip_code) ? $auktion->zip_code : "",
'#select2' => ['width' => '100%', 'placeholder' => t('Enter a zipcode'), 'allowClear' => TRUE],
'#empty_option' => '',
'#validated' => TRUE,
'#required' => TRUE,
'#ajax' => array(
'event' => 'change',
'callback' => 'ajax_example_dependent_dropdown_callback',
'wrapper' => 'dropdown-second-replace',
),
];
Referenced many links but cannot find a solution to resolve this issue.
References:
https://www.drupal.org/node/586576