the js looks at each input using: document.getElementById("name"). If it sees that the input is blank it colors the input yellow, selects it, and give is focus. Pretty simple, I use it on another form that has different inputs:
I literally copied that from another function (just changed the variable and id to name). When I submit I can see it take the blank input yellow, then it reloads the whole form. My other forms work fine.