I have 3 lists on a site Point of sale, inventory and EMPINFO I have fields that employees can scan with a barcode reader and it pulls the inventory item along with the price and item description this works great. I have another lookup field for Employee which I hope to have the employee scan their badge and then pull their Name over to the form. the Employee ID is stored as a 10 digit number in the EMPINFO list which we import from payroll daily. but when the employee scans their badge it comes across as %12345678905? so I can't scan directly into the lookup field. To get around that I created a SLT field where they scan into then grab the digits only. but I cannot set the lookup field with that value the alerts display the proper value. wondering what your solution would be. below is the code I have to convert the value to digits only and one attempt to set the lookup field. I am assuming the issue is the lookup field is looking for the ID from the EMPID List and not the EMPID.
function empbadge()
{
var scanField = fd.field('Employee_x0020_Number_x0028_Scan');
var nameField = fd.field('Employee_x0020_Name');
if (scanField && nameField)
{
var scanValue = scanField.value || '';
var digitsOnly = scanValue.replace(/\D/g, '');
alert(scanValue);
alert(digitsOnly);
fd.field('Employee_x0020_Name').value = digitsOnly ;
}
}