you need to instead check if there are no  errors yet instead of  checking if name is not null