Problem/Motivation

I am using module together with ajaxify_pages module which loads and replaces only part of page.
After another page containing form is loaded it is necessary to attach drupal behaviours to loaded form, but behaviours are not in Drupal.setings but in loaded page settings variable like this:

Drupal.attachBehaviors( $(loadedContent), loadedSettings );

Current implementation of clientsideValidation ignores second parameter loadedSettings and always uses Drupal.settings

For other base drupal modules this works!

Proposed resolution

According to Drupal API attach method have second parameter settings, that allows to attach setting not only from global Drupal variable, but also from different settings variable.

To support it, Drupal.behaviors.clientsideValidation attach function should have second parameter and should look like this:

  Drupal.behaviors.clientsideValidation = {
    attach: function (context, settings) {
        
      if (!Drupal.myClientsideValidation) {
        if (settings.clientsideValidation) {
          Drupal.myClientsideValidation = new Drupal.clientsideValidation();
        }
      }
      else {
        if (typeof(settings.clientsideValidation.forms) === 'undefined') {
          return;
        }

..................
..................
..................

See, settings variable is used instead of Drupal.settings

Comments

vangoga’s picture

Issue summary: View changes