validate posts, and create helper method to display error messages