Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a custom form built with the Forms API and my elements have custom AJAX callbacks. When I click on an element with AJAX callback, I get an JavaScript error from the Clientside Validation IFE module.
Thank you for looking at this.
The error is getting thrown from this function:
(/** @lends Drupal */function ($) {
"use strict";
/**
* Drupal.behaviors.clientsideValidationHtml5.
*
* Attach clientside validation to the page for HTML5.
*/
Drupal.behaviors.clientsideValidationIfe = {
attach: function () {
$(document).bind('clientsideValidationInitialized', function (){
/**
* IFE specific rules.
* @name _bindIfeRules
* @memberof Drupal.clientsideValidation
* @method
* @private
*/
jQuery.each(Drupal.myClientsideValidation.validators, function (formid) {
Drupal.myClientsideValidation.validators[formid].showErrors(Drupal.settings.clientsideValidation.forms[formid].serverSideErrors);
});
});
}
};
})(jQuery);
Comment | File | Size | Author |
---|---|---|---|
#3 | clienside_validation-ife-server-side-errors-of-undefined-2268513-3.patch | 1.96 KB | vlad.dancer |
Comments
Comment #1
DianovVS CreditAttribution: DianovVS commentedI fixed that problem with help that condition: if (Drupal.settings.clientsideValidation.forms[formid] !== undefined) {...}
Replace code in your file ...\clientside_validation_ife.js
Comment #2
DianovVS CreditAttribution: DianovVS commentedComment #3
vlad.dancerHi there!
@DianovVS, unfortunately this just fixes broken js but doesn't resolve the problem.
I believe the problem comes from clientside_validation_ife.module
+ in clientside_validation_ife.js should have some cleaning code to remove empty "ife" elements.
Below is the patch that fixes this issue.
Please review it!
Comment #4
attiks CreditAttribution: attiks commentedComment #6
Jelle_SFixed in latest dev. Thanks for the patch!