Design Dabbler

Autoselecting dropdown choice from SQL control.

I'm having trouble with a SQL control and using javascript to select the first result in the dropdown list. I have 2 sql controls that are set up the same exact way other than pulling different data. I am using the javascript below to autoselect the first result. It works fine for the first one, setVendorID() but it does not work for setRemit() and I can not figure out why. I can run the code inside the if statements in the console and the first one works fine and it will set the dropdown for VendorID but not for RemitToAddress. I even tried completely removing the VendorID portion of the code to see if it was conflicting but that did not work either. What could I be missing?

function setVendorID() {
if (NWF$("#" + varVendorIDCount).val() === '1') {
var sqlVendorID_X = sqlVendorID.replace('_hid', "");
NWF$('#' + sqlVendorID_X).prop('selectedIndex', 1);
NWF$('#' + sqlVendorID_X).trigger("change");
} else {}

function setRemit() {
if (NWF$("#" + varRemitCount).val() === '1') {
var sqlRemitToAddress_X = sqlRemitToAddress.replace('_hid', "");
NWF$('#' + sqlRemitToAddress_X).prop('selectedIndex', 1);
NWF$('#' + sqlRemitToAddress_X).trigger("change");
} else {}

0 Kudos