Many browsers use a sort of autocomplete function. So the moment you already entered data in a field it will be added to there remembering list.

I would like to have no suggestion for fields.

A solution for this is using autocomplete on/off for the input fields http://www.w3schools.com/tags/att_input_autocomplete.asp I do not understand the compliance for the different browser...

I use many fields in my system. I do not want this for all fields.

There are some solution with modules but not for all fields: https://www.drupal.org/project/no_autocomplete = only working for login screens

What ways are there to implement this in a easy way in Drupal 7? I guess to have a hook_form_alter but then?

I guess something like this:

  ' Setuplist with fields automcomplete should be off
    afields_setautomcompleteoff ("fieldname1", "fieldname2","fieldname3")

    ' Look if the current form contains a fields with should be edited
    if(count(array_intersect(?????, $afields_setautomcompleteoff)) == 1){
        'add att to input field but how? 

Any suggestions?


1 Answer 1


Take a look at hook_form_alter. Also refer to the drupal FAPI, there are many form controls are available which you can use in a form.

For your case, below example will be helpful.

function example_form_alter(&$form, &$form_state, $form_id) {
  if($form_id === 'your_form_id'){
     $form['your_field']['#attributes'] = array('autocomplete' => 'Off');

Other option is with JS.

Drupal.behaviors.exampleModule = {
  attach: function (context, settings) {
    $('input[type="text"]').each(function (i, input) {
      $(input).attr('autocomplete', 'off);

Not the answer you're looking for? Browse other questions tagged or ask your own question.