Update client.js

add validation