Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

trackForm will submit a form even if the event has been prevented #431

@rsobers

Description

@rsobers

If a form submit event has been prevented by some other code (e.g., because client-side field validation failed), Segment's trackForm will still call submit and essentially override the prevention. As a result, the form will be POSTed and the track calls will be executed even though the action didn't really happen.

I rolled my own version for now which checks event.isDefaultPrevented() and if it's true will bail out before submitting the form or calling track.

I realize this might not be the result everyone wants, just thought I'd raise the issue.

Note: KISSMetrics' trackSubmit is in between--if the event has been prevented, it won't submit the form, but it will track the event (causing event inflation). I think this is because they're not calling prevent but just inserting a delay.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions