code the form and validate