Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $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',
- ),
- ];
- $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);
- if(!is_array($ort_options)){
- $ort_options=array();
- }
Add Comment
Please, Sign In to add comment