The process you need to do is called validation. If you google for 'validate' AND 'insert the type of grid you are using here', you will get thousands of possible solutions. Do a little work first, then if you get stuck on a particular part of it, ask again.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”