The before-form-submit event
is fired before the submission of a signup block form. This is one of the various events Wisepops can trigger as part of our JS callbacks feature.
This event occurs before the form validation. It will be triggered even if the email has an invalid format, or if a required field is left empty.
Prevent form submit
The submission of the form can be prevented, by calling preventDefault()
on the event:
wisepops('listen', 'before-form-submit', function(event) {
event.preventDefault();
});
Preventing this event will have the following consequences:
The filled data won't be collected
The action won't happen (load new page, scroll to anchor, close popup)
The condition "Stop showing after signup" won't be met
The Clicks and Emails counters won't be incremented
The after-form-submit event won't be fired
Event target
The targeted element (event.target
) is the same element as the native submit event target.
This means that you can easily retrieve the fields of your form (and their values) by using event.target.elements['Field ID']
. To retrieve the email value, you must write:
var emailValue = event.target.elements['email'].value;
Use cases