Check that the input is valid