adds form validation on server and client side