Take a look at some of these links, they should get you on the right track:
Previous SF post - How to display the custom message in SDL Tridion Message bar?
Validating Tridion Content Part 1 - http://nunolinhares.blogspot.co.uk/2012/07/validating-content-on-save-part-1-of.html
Validating Tridion Content Part2 - http://www.curlette.com/?p=913
Cheers