Contact Form 7 Custom DOM Event Uses Colon Namespacing $(data.into).trigger('wpcf7:mailsent'). How does the...
MY QUESTION
If the jQuery custom event is namespaced with a colon like 'wpcf7:mailsent'
or 'wpcf7:submit'
, why or how does the DOM event NAME become wpcf7mailsent
or wpcf7submit
? Are they joined somehow by some DOM process?
MORE CONTEXT
Wordpress's Contact Form 7 provides several types of custom DOM events. When I look at the plugin's source code, I'm trying to understand how these names are created in the DOM and where they're coming from.
List of Contact Form 7 Custom DOM Events
wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
Source: wp-plugins/contact-form-7 Github repo
The code that processes the form data (I think):
$.fn.wpcf7InitForm = function() {
this.ajaxForm({
beforeSubmit: function(arr, $form, options) {
$form.wpcf7ClearResponseOutput();
$form.find('[aria-invalid]').attr('aria-invalid', 'false');
$form.find('img.ajax-loader').css({ visibility: 'visible' });
return true;
},
beforeSerialize: function($form, options) {
$form.find('[placeholder].placeheld').each(function(i, n) {
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: $.wpcf7AjaxSuccess,
error: function(xhr, status, error, $form) {
var e = $('<div class="ajax-error"></div>').text(error.message);
$form.after(e);
}
});
I noticed the part:
success: $.wpcf7AjaxSuccess,
Inside the $.wpcf7AjaxSuccess = function(data, status, xhr, $form) {... ...}
part was these codes:
$(data.into).trigger('wpcf7:mailsent');
$(data.into).trigger('mailsent.wpcf7'); // deprecated
and
$(data.into).trigger('wpcf7:submit');
$(data.into).trigger('submit.wpcf7'); // deprecated
javascript jquery ajax dom contact-form-7
add a comment |
MY QUESTION
If the jQuery custom event is namespaced with a colon like 'wpcf7:mailsent'
or 'wpcf7:submit'
, why or how does the DOM event NAME become wpcf7mailsent
or wpcf7submit
? Are they joined somehow by some DOM process?
MORE CONTEXT
Wordpress's Contact Form 7 provides several types of custom DOM events. When I look at the plugin's source code, I'm trying to understand how these names are created in the DOM and where they're coming from.
List of Contact Form 7 Custom DOM Events
wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
Source: wp-plugins/contact-form-7 Github repo
The code that processes the form data (I think):
$.fn.wpcf7InitForm = function() {
this.ajaxForm({
beforeSubmit: function(arr, $form, options) {
$form.wpcf7ClearResponseOutput();
$form.find('[aria-invalid]').attr('aria-invalid', 'false');
$form.find('img.ajax-loader').css({ visibility: 'visible' });
return true;
},
beforeSerialize: function($form, options) {
$form.find('[placeholder].placeheld').each(function(i, n) {
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: $.wpcf7AjaxSuccess,
error: function(xhr, status, error, $form) {
var e = $('<div class="ajax-error"></div>').text(error.message);
$form.after(e);
}
});
I noticed the part:
success: $.wpcf7AjaxSuccess,
Inside the $.wpcf7AjaxSuccess = function(data, status, xhr, $form) {... ...}
part was these codes:
$(data.into).trigger('wpcf7:mailsent');
$(data.into).trigger('mailsent.wpcf7'); // deprecated
and
$(data.into).trigger('wpcf7:submit');
$(data.into).trigger('submit.wpcf7'); // deprecated
javascript jquery ajax dom contact-form-7
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54
add a comment |
MY QUESTION
If the jQuery custom event is namespaced with a colon like 'wpcf7:mailsent'
or 'wpcf7:submit'
, why or how does the DOM event NAME become wpcf7mailsent
or wpcf7submit
? Are they joined somehow by some DOM process?
MORE CONTEXT
Wordpress's Contact Form 7 provides several types of custom DOM events. When I look at the plugin's source code, I'm trying to understand how these names are created in the DOM and where they're coming from.
List of Contact Form 7 Custom DOM Events
wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
Source: wp-plugins/contact-form-7 Github repo
The code that processes the form data (I think):
$.fn.wpcf7InitForm = function() {
this.ajaxForm({
beforeSubmit: function(arr, $form, options) {
$form.wpcf7ClearResponseOutput();
$form.find('[aria-invalid]').attr('aria-invalid', 'false');
$form.find('img.ajax-loader').css({ visibility: 'visible' });
return true;
},
beforeSerialize: function($form, options) {
$form.find('[placeholder].placeheld').each(function(i, n) {
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: $.wpcf7AjaxSuccess,
error: function(xhr, status, error, $form) {
var e = $('<div class="ajax-error"></div>').text(error.message);
$form.after(e);
}
});
I noticed the part:
success: $.wpcf7AjaxSuccess,
Inside the $.wpcf7AjaxSuccess = function(data, status, xhr, $form) {... ...}
part was these codes:
$(data.into).trigger('wpcf7:mailsent');
$(data.into).trigger('mailsent.wpcf7'); // deprecated
and
$(data.into).trigger('wpcf7:submit');
$(data.into).trigger('submit.wpcf7'); // deprecated
javascript jquery ajax dom contact-form-7
MY QUESTION
If the jQuery custom event is namespaced with a colon like 'wpcf7:mailsent'
or 'wpcf7:submit'
, why or how does the DOM event NAME become wpcf7mailsent
or wpcf7submit
? Are they joined somehow by some DOM process?
MORE CONTEXT
Wordpress's Contact Form 7 provides several types of custom DOM events. When I look at the plugin's source code, I'm trying to understand how these names are created in the DOM and where they're coming from.
List of Contact Form 7 Custom DOM Events
wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.
Source: wp-plugins/contact-form-7 Github repo
The code that processes the form data (I think):
$.fn.wpcf7InitForm = function() {
this.ajaxForm({
beforeSubmit: function(arr, $form, options) {
$form.wpcf7ClearResponseOutput();
$form.find('[aria-invalid]').attr('aria-invalid', 'false');
$form.find('img.ajax-loader').css({ visibility: 'visible' });
return true;
},
beforeSerialize: function($form, options) {
$form.find('[placeholder].placeheld').each(function(i, n) {
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: $.wpcf7AjaxSuccess,
error: function(xhr, status, error, $form) {
var e = $('<div class="ajax-error"></div>').text(error.message);
$form.after(e);
}
});
I noticed the part:
success: $.wpcf7AjaxSuccess,
Inside the $.wpcf7AjaxSuccess = function(data, status, xhr, $form) {... ...}
part was these codes:
$(data.into).trigger('wpcf7:mailsent');
$(data.into).trigger('mailsent.wpcf7'); // deprecated
and
$(data.into).trigger('wpcf7:submit');
$(data.into).trigger('submit.wpcf7'); // deprecated
javascript jquery ajax dom contact-form-7
javascript jquery ajax dom contact-form-7
edited Nov 15 '18 at 19:44
Jarad
asked Nov 15 '18 at 17:38
JaradJarad
4,95953368
4,95953368
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54
add a comment |
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53325098%2fcontact-form-7-custom-dom-event-uses-colon-namespacing-data-into-triggerwpc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53325098%2fcontact-form-7-custom-dom-event-uses-colon-namespacing-data-into-triggerwpc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'd venture an educated guess that colons (:) aren't valid in the naming convention and likely just get stripped of invalid characters.
– Zmart
Nov 15 '18 at 19:54