Skip to content
Snippets Groups Projects
Commit a9f2eead authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2456225 by nod_, drupaldrop, droplet: Improve formUpdated event

parent 34e94f04
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -212,6 +212,7 @@ drupal.machine-name: ...@@ -212,6 +212,7 @@ drupal.machine-name:
- core/jquery.once - core/jquery.once
- core/drupal - core/drupal
- core/drupalSettings - core/drupalSettings
- core/drupal.form
drupal.progress: drupal.progress:
version: VERSION version: VERSION
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
// Initialize form behaviors, use $.makeArray to be able to use native // Initialize form behaviors, use $.makeArray to be able to use native
// forEach array method and have the callback parameters in the right order. // forEach array method and have the callback parameters in the right order.
$.makeArray($forms).forEach(function (form) { $.makeArray($forms).forEach(function (form) {
var events = 'change.formUpdated keypress.formUpdated'; var events = 'change.formUpdated input.formUpdated ';
var eventHandler = debounce(function (event) { triggerFormUpdated(event.target); }, 300); var eventHandler = debounce(function (event) { triggerFormUpdated(event.target); }, 300);
formFields = fieldsList(form).join(','); formFields = fieldsList(form).join(',');
......
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
// changes, but only if there is no machine name yet; i.e., only upon // changes, but only if there is no machine name yet; i.e., only upon
// initial creation, not when editing. // initial creation, not when editing.
if ($target.val() === '') { if ($target.val() === '') {
$source.on('keyup.machineName change.machineName input.machineName', eventData, machineNameHandler) $source.on('formUpdated.machineName', eventData, machineNameHandler)
// Initialize machine name preview. // Initialize machine name preview.
.trigger('keyup'); .trigger('formUpdated.machineName');
} }
// Add a listener for an invalid event on the machine name input // Add a listener for an invalid event on the machine name input
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment