in reply to Error Validation

Upon submitting the username and password, the data goes to the server(using GET/POST methods).
The server validates and redirects to home page if authentication success, displays error otherwise.
source of the login page is updated by the server after submitting, so initial source may not contain 'error message' by default.
If you need good answers provide more clarity on what you are trying to achieve.

Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.