proper syntax for the if check on client side to display errors