How to make the bill to address auto populate the ship to address if a checkbox is checked?
Hello,
I'm creating a form in which if someone fills out the bill to section of the form and checks our "Same As Bill To" check box, then all the rest of the fields will auto populate. So far I have had no luck executing this.
My check box is named "SameAsBillTo", and if it's checked I want all the following field names to equal each other:
Customer name2 ("CustomerName2") = Customer Name1 ("CustomerName1")
"Street2" = "Street1"
"City2" = "City1"
"State2" = "State1"
"Zip2" = "Zip1"
"Contact2" = "Contact1"
"ContactEmail2" = "ContactEmail1"
"ContactPhone2" = "ContactPhone1"
I have minor experience using javascript editor but, previously I have been successful using it for formulas. I researched this question on a bunch of other forums and have tried coping similar codes and have matched it with mine, but nothing has worked yet. Below is an example of my current code:
if(SameAsBillTo=="Yes"){
this.getField("CustomerName2").value = this.getField("CustomerName1").valueAsString;
this.getField("Street2").value = this.getField("Street1").valueAsString;
this.getField("City2").value = this.getField("City1").valueAsString;
this.getField("State2").value = this.getField("State1").valueAsString;
this.getField("Zip2").value = this.getField("Zip1").valueAsString;
this.getField("Contact2").value = this.getField("Contact1").valueAsString;
this.getField("ContactEmail2").value = this.getField("ContactEmail1").valueAsString;
this.getField("ContactPhone2").value = this.getField("ContactPhone1").valueAsString;
}
Note - "SameAsBillTo" is my check box
Am I on the right path and just messing up the code? Or is there a total different code I need to use? Any help would be much appreciated!
