Is there a way to have the lookup rule work correctly on a field populated via JavaScript?
I have an HR database and want a simple form with a single lookup field to find an employee and return their name, desk number, phone extension, etc. The catch is I also want them to be able to search on multiple criteria through one field.
I tried having multiple lookup rules for the same field but after it returned the information it would wipe it out a second later, most likely due to the next lookup failing.
Now I have tried using invisible fields with their own lookup rules. These fields are populated by jQuery script depending on what type of information is entered into the lookup field.
For example here is a simple test for two possible lookups. Seat numbers are 3 digits and phone extensions are 4 digits. Field q22 has a lookup rule for seat numbers and q20 has a lookup rule for extension numbers.
$(document).ready(function() {
$('#q17 input').change(function() {
if ($(this).val() < 999) {
$('#q22 input').val($(this).val());
}
else if ($(this).val() > 999) {
$('#q20 input').val($(this).val());
}
});
});
The fields populate but nothing is returned from the database unless I manually change fields.