Hi Jamie,
Assuming that you know each bank's address and swift code and can define it statically, you can use the code below.
// -- bankScript begin
// Array of part banks or you can know the order of the banks.
var banks = new Array(" ",
"Bank1",
"Bank2");
// Array of bank addresses.
var bankAdd = new Array(null,
"Bank 1 Add",
"Bank 2 Address");
// Array of bank swift code.
var bankSwift = new Array(null,
"SF1",
"SF2");
function getBankInfo(bankName, bankAddField, bankSwiftCodeField)
{
var i;
for (i = 0; i < banks.length; i++) // Go through the entire list of banks to find the one that is currently selected.
{
if (banks[i] == bankName) // When find the bank currently selected.
{
bankAddField.rawValue = bankAdd[i]; // Put the address to the adress field
bankSwiftCodeField.rawValue = bankSwift[i]; // Put the swift code to the swift code field.
break; // No need to go further if there is a match.
}
}
}
// You can save the above code as a script by right clicking the Variables of the form and Insert Script object
// name the script as bankScript
// -- bankScript end
// In the change event of the dropdown list
bankScript.getBankInfo(xfa.event.newText, txtBankAddressField, txtSwiftCodeField);
//xfa.event.newText Specifies the content of the field after it changes in response to the actions of a user.
Hope It helps
Asiye