You can add the onsubmit handler for your login form. This handler can help you prevent submitting your form (and for example move your cursor to the next empty field in the forms);
<form onsubmit="do_some_function(); return false;" ></form>
To prevent form from submition, return false in your onsubmit handler;