added client-side form validation for convenience