add validate in javascript