server side and client side validation with shared code