Details

Applies to
Release 1.5.3 [Revision release]
Purpose
Improve the javascript function used to disable the search buttons
Description
The current javascript function ignores the fact that we already have the form that we want to disable the buttons for, and insted searches the entire document for the button based on its id. this patch takes advantage of the fact we already have the form and just disables the buttons on the form. this also make the javascript more general and potentualy more widely usable

Patch

   1 --- theme/__init__.py   2006-04-15 13:09:38.000000000 -0600
   2 +++ theme.new/__init__.py       2006-05-05 11:41:12.000000000 -0600
   3 @@ -728,14 +728,16 @@
   4      var value = e.value.replace(/\s+/, '');
   5      if (value == '' || searchIsDisabled) {
   6 -        searchSetDisabled(true);
   7 +        formSetDisabled(e.form,true);
   8      } else {
   9 -        searchSetDisabled(false);
  10 +        formSetDisabled(e.form,false);
  11      }
  12  }
  13 
  14 -function searchSetDisabled(flag) {
  15 -    // Enable or disable search
  16 -    document.getElementById('fullsearch').disabled = flag;
  17 -    document.getElementById('titlesearch').disabled = flag;
  18 +function formSetDisabled(theform,flag) {
  19 +    for (i = 0; i < theform.length; i++) {
  20 +        var tempobj = theform.elements[i];
  21 +        if (tempobj.type.toLowerCase() == "submit")
  22 +            tempobj.disabled = flag;
  23 +    }
  24  }
theme_init.patch

Discussion

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/SearchButtonDisable (last edited 2007-10-29 19:19:06 by localhost)