I am using https://www.drupal.org/project/autocomplete_deluxe in Drupal 8.

function custom_module_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {  
  $form['field_all_value']['widget']['value']['#ajax'] = [
    'event' => 'change',
    'callback' => 'get_ajax_callback',
    'wrapper' => 'edit-field-test-wrapper'

function get_ajax_callback(&$form, FormStateInterface $form_state) {

  $form['field_test']['widget']['target_id']['#default_value'] = 'A, B';

  return $form['field_test'];

On checkbox check I have to fill all the values in auto deluxe form field.

  • Did you try with $form['field_test']['widget']['target_id']['#default_value'] = ['A', 'B']; ? – berramou May 3 at 8:15
  • Hi @berramou tried not working – Julia May 3 at 8:29
  • Hey, you can fill an input and dump it in submit to see how auto deluxe module fill the input an then do the same . – berramou May 3 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.