setup register form validation and save function