add the validation when click done or add.