Skip to content

Instantly share code, notes, and snippets.

@mendelB
Created October 11, 2019 18:07
Show Gist options
  • Save mendelB/eb3a02c1ce1d5951fe48d09df65c18a9 to your computer and use it in GitHub Desktop.
Save mendelB/eb3a02c1ce1d5951fe48d09df65c18a9 to your computer and use it in GitHub Desktop.
$('#profile-subscriptions-form').on('submit', () => {
var $form = $(this);
var $validationFields = $form.find("[data-validate]");
$validationFields = $validationFields.map(function() {
var $this = $(this);
if(typeof $this.attr("data-validate-required") !== "undefined" || $this.val() !== "") {
return $this;
}
});
if ($validationFields.length) {
return;
}
trackAnalyticsEvent({
metadata: {
noun: 'register',
target: 'form',
verb: 'submitted',
// ...
},
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment