takes an input from the form and validates it