chromium/chrome/test/data/autofill/dynamic_form_with_no_name_select_options_change.html

<!-- A page that is used to test that a dynamic form fill feature works properly when select options are added/removed even if the form has no name. -->
<body>
  <form id="form1" action="https://example.com/" method="post">
    Name: <input type="text" name="firstname" id="firstname" autocomplete="given-name"><br>
    Address: <input type="text" name="address1" id="address1"><br>
    City: <input type="text" name="city" id="city"><br>
    State: <select name="state" id="state">
      <option value="ON">ON</option>
      <option value="QC">QC</option>
      <option value="AB">AB</option>
    </select> <br>
    Zip: <input name="zip" id="zip"> <br>
    Country: <select name="country" id="country" onchange="CountryChanged()">
      <option value="CA">Canada</option>
      <option value="US">United States</option>
    </select> <br>
    Company: <input name="company" id="company"> <br>
    Email: <input name="email" id="email"> <br>
    Phone: <input name="phone" id="phone"> <br>
    <input type="reset" value="Reset">
    <input type="submit" value="Submit" id="profile_submit">
  </form>
</body>

<script>
function CountryChanged() {
  var first_name_input = document.getElementById("firstname");
  // Reset the value of the first name field.
  first_name_input.value = '';

  // Reset the value of the address field.
  document.getElementById("address1").value = '';

  // Get the select object.
  var state_select = document.getElementById("state");

  // Remove the provinces options.
  for (var i=0; i<state_select.length; i++) {
     state_select.remove(i);
  }

  // Add the states options.
  state_select.options[0] = new Option('WA', 'WA');
  state_select.options[1] = new Option('MA', 'MA');
  state_select.options[2] = new Option('TX', 'TX');

  window['refill'] = true;
  console.log('An event happened that should trigger a refill.');
}
</script>