Form being submitted even when a mandatory field is not completed