implemented validate method for field validation in custom forms