Validate user input.