added client side validations

still to do some server side validations and send back a pretty json
response