I have something like:
Adding a small timeout and resetting the focus back to the partNumber
textbox should do the trick.
Thus your validatePart()
function becomes something like:
function validatePart(node) {
if (!node.value) {
alert('Please enter a part number.');
setTimeout(function(){node.focus();}, 1);
}
}
Here's a quick "live" example that simply fires an alert
no matter what is entered into the partNumber
textbox and successfully returns focus back to the partNumber
textbox (even if you tab off it to the quantity
textbox.