8 - Register form automatically fills in input fields I am using the core user-register-form to let users register to my site. When I first want to register a new account the form is displayed as followed:



Now, when I enter credentials and submit the form, the user is created. I can login and out with the created user.

However, if I want to register ANOTHER new account the form automatically fills in the e-mail and username of the user I just created. 



I have tried several things that did not solve the problem:


Clear Drupal cache
Close browser and re-open 
Kill browser and re-open 
Open incognito browser 
Clear browser cache 
Disabled browser auto-fill


I also tried clearing the inputs using jQuery val(''); but then the form doesn't submit properly.

I assume this has something to do with drupal core? Please advice!
I found a solution thanks to the Drupal Community

Apparently this is defined in the core of Drupal: core/modules/user/src/RegisterForm.php

The following should be set to FALSE

// For non-admin users, populate the form fields using data from the browser.
    if (!$admin) {
      $form['#attributes']['data-user-info-from-browser'] = TRUE;
    }


However it would be better to not mess with the core values and write a form_hook_alter instead in your theme file:

function MYTHEME_form_alter( &amp;$form, &amp;$form_state, $form_id ) {
  if ( TRUE === in_array( $form_id, array( 'user_register_form') ) ) {
    $form['#attributes']['data-user-info-from-browser'] = FALSE;
  }
}


This solved the problem.