diff -u b/core/includes/form.inc b/core/includes/form.inc --- b/core/includes/form.inc +++ b/core/includes/form.inc @@ -3864,8 +3864,20 @@ if (!empty($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) { $element['#attributes']['class'][] = 'form-autocomplete'; $element['#attached']['library'][] = array('system', 'drupal.autocomplete'); - // Provide a data attribute for the JavaScript behavior to bind to. - $element['#attributes']['data-autocomplete-path'] = url($element['#autocomplete_path'], array('absolute' => TRUE)); + // Provide a hidden element for the JavaScript behavior to bind to. Since + // this element is for client-side functionality only, and we don't want to + // collect any input from it, use #theme='hidden' instead of #type='hidden'. + // @todo Refactor autocomplete.js to accept Drupal.settings instead of + // requiring extraneous markup. + $element['autocomplete'] = array( + '#theme' => 'hidden', + '#attributes' => array( + 'id' => $element['#id'] . '-autocomplete', + 'value' => url($element['#autocomplete_path'], array('absolute' => TRUE)), + 'class' => array('autocomplete'), + 'disabled' => 'disabled', + ), + ); } return $element; } @@ -4084,20 +4096,8 @@ if (!empty($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) { $element['#attributes']['class'][] = 'form-autocomplete'; $element['#attached']['library'][] = array('system', 'drupal.autocomplete'); - // Provide a hidden element for the JavaScript behavior to bind to. Since - // this element is for client-side functionality only, do not process input. - // @todo Refactor autocomplete.js to accept Drupal.settings instead of - // requiring extraneous markup. - $element['autocomplete'] = array( - '#type' => 'hidden', - '#input' => FALSE, - '#value' => url($element['#autocomplete_path'], array('absolute' => TRUE)), - '#disabled' => TRUE, - '#attributes' => array( - 'class' => array('autocomplete'), - 'id' => $element['#id'] . '-autocomplete', - ), - ); + // Provide a data attribute for the JavaScript behavior to bind to. + $element['#attributes']['data-autocomplete-path'] = url($element['#autocomplete_path'], array('absolute' => TRUE)); } return $element; }