<!-- A page that is used to test that a dynamic form fill feature works properly. -->
<body>
<form name="addr1.1" id="form1" action="https://example.com/" method="post">
Name: <input type="text" name="firstname" id="firstname" autocomplete="given-name"><br>
<input type="text" name="firstname" id="firstname2" autocomplete="given-name" style="display: none"><br>
Address: <input type="text" name="address1" id="address1"><br>
City: <input type="text" name="city" id="city"><br>
<input type="text" name="state_us" id="state_us" style="display: none;" autocomplete="region"><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() {
// Reset the value of the address field.
var address1 = document.getElementById('address1');
address1.value = '';
window['refill'] = true;
console.log('An event happened that should trigger a refill.');
// Change the element that triggered the autofill. Remove it, and make another
// field visible. This is to test if the autofill can handle the case where
// the clicked on element is no longer valid.
var first_name_input = document.getElementById("firstname");
first_name_input.parentNode.removeChild(first_name_input);
var name_later = document.getElementById("firstname2");
name_later.removeAttribute('style');
}
</script>