Created function in validating prompts

Created function in validating prompts