Added methods to validate form data.