summaryrefslogtreecommitdiff
path: root/misc/form.js
blob: 2a2e02dad8ee7aa5aad241d9985b528cbd79f9b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// $Id$
(function($) {

Drupal.behaviors.multiselectSelector = {
  attach: function(context, settings) {
    // Automatically selects the right radio button in a multiselect control.
    $('.multiselect select:not(.multiselectSelector-processed)', context)
      .addClass('multiselectSelector-processed').change(function() {
        $('.multiselect input:radio[value="'+ this.id.substr(5) +'"]')
          .attr('checked', true);
    });
  }
};


/**
 * Automatically displays the guidelines of the selected text format.
 */
Drupal.behaviors.filterGuidelines = {
  attach: function(context) {
  $('.filter-guidelines:not(.filterGuidelines-processed)', context)
      .addClass('filterGuidelines-processed')
      .find('label').hide()
      .parents('.filter-wrapper').find('select.filter-list')
      .bind('change', function() {
        $(this).parents('.filter-wrapper')
        .find('.filter-guidelines-item').hide()
        .siblings('#filter-guidelines-' + this.value).show();
      })
      .change();
  }
};

})(jQuery);