Copy Field Values to Other Fields in the Same Form

Howtocopyfielddatatootherfieldsinthesameform.nitro_s

This example demonstrates how you can use some very simple javaScript to copy data from one set of fields to another based on a user action.

All of the code is in the onItemChange event of the Checkbox:

// if the checkbox is checked then we use the JS API functions to get the billing field data and copy it into the shipping fields

if(BOA.getValue()) {
  BO.F_ShipAdd1.setValue(BO.F_BillAdd1.getValue());
  BO.F_ShipAdd2.setValue(BO.F_BillAdd2.getValue());
  BO.F_ShipCity.setValue(BO.F_BillCity.getValue());
  BO.F_ShipState.setValue(BO.F_BillState.getValue());
  BO.F_ShipZip.setValue(BO.F_BillZip.getValue());
  BO.F_ShipCountry.setValue(BO.F_BillCountry.getValue());
} else { // if unchecked then we clear the shipping fields
  BO.F_ShipAdd1.setValue("");
  BO.F_ShipAdd2.setValue("");
  BO.F_ShipCity.setValue("");
  BO.F_ShipState.setValue("");
  BO.F_ShipZip.setValue("");
  BO.F_ShipCountry.setValue("");
}