adds validation to the registration form - props to Saumya Dwivedi (dvd)