Autofill inputs with a checkbox
Posted: Tue Dec 20, 2005 12:02 pm
I want to be able to auto fill in inputs if the user decides that both their mailing address and location address are the same. I have the accomplished my only problem is that if the user unselects the checkbox my program does not UN auto fill the input boxes.
My program leaves the location address fields enabled until the users checks off the box, then the program disables the inputs and fills in the information from the mailing address fields. I want the program to enable the inputs and UN fill the inputs if the user UN checks the check box.
Here is my code so far:
JAVA:
HTML:
My program leaves the location address fields enabled until the users checks off the box, then the program disables the inputs and fills in the information from the mailing address fields. I want the program to enable the inputs and UN fill the inputs if the user UN checks the check box.
Here is my code so far:
JAVA:
Code: Select all
function DisableInput() {
document.new_request.location_address.disabled = true;
document.new_request.location_city.disabled = true;
document.new_request.location_state.disabled = true;
document.new_request.location_zip.disabled = true;
document.new_request.location_address.value = document.new_request.mailing_address.value;
document.new_request.location_city.value = document.new_request.mailing_city.value;
document.new_request.location_state.value = document.new_request.mailing_state.value;
document.new_request.location_zip.value = document.new_request.mailing_zip.value;
}Code: Select all
<input type="checkbox" name="make_same" class="fields" onClick="DisableInput();">