Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
novicell/custom_forms / js / custom-forms-error-command.js
Size: Mime:
(function ($, Drupal) {
    'use strict';
    // Drupal ajax command for adding a custom form inline error to a field.
    Drupal.AjaxCommands.prototype.addCustomFormsError = function (ajax, response, status) {
        let message = response.message;
        $(response.selector).closest('.js-custom-forms-item__field').append('<div class="form-item--error-message">'+response.message+'</div>')
    };
    // Drupal ajax command for removing any existing inline custom form errors.
    Drupal.AjaxCommands.prototype.removeCustomFormsError = function (ajax, response, status) {
      $(response.selector).closest('.js-custom-forms-item__field').children('div.form-item--error-message').remove();
    };
})(jQuery, Drupal);