add validation function for post edit page