Validates the form on form submission (setting the right classes and properties)