Holding field focus

Holding field focus

I have validation code in the On User Input section of a form field. If the user does not enter the correct information, I alert them with an alert statement. After that however, the field focus is lost completely. I want to be able to hold field focus on this field until the information is correctly entered. Is there a way to do that?