Why is form being submitted without a required element?