make the client side validation work with server side