CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • /templates/CRM/common/Filter.tpl bugfix for review.
Pages: [1]

Author Topic: /templates/CRM/common/Filter.tpl bugfix for review.  (Read 1321 times)

AJA

  • Guest
/templates/CRM/common/Filter.tpl bugfix for review.
October 03, 2009, 01:02:22 pm
The javascript popup that handles tokens was not functional on our 3.0.0 Stable install, so I fixed a few problems. The two javascript variables at the top of /templates/CRM/common/Filter.tpl had/have problems. First is that (evidently) the "document" object isn't happy being assigned to a global variable, and all global variables must be instantiated using "var" prior to the variable name.

Here's the diff on that file for the fixes I made to get it working on our server.

Let me know if I should go ahead and file this with the issue tracker.

Code: [Select]

--- Desktop/civicrm/templates/CRM/common/Filter.tpl     2009-09-25 06:17:59.000000000 -0700
+++ NetBeansProjects/GW/sites/all/modules/civicrm/templates/CRM/common/Filter.tpl       2009-10-03 12:53:55.000000000 -0700
@@ -1,10 +1,10 @@
 {literal}
-d = document;
-stregexp = new RegExp;
+var stregexp = new RegExp;
 
 function initFilter( id ) {
     //build the array
     filterArray = new Array();
+
     {/literal}
     {foreach from=$tokens item=tokenName key=tokenKey}
     filterArray["{$tokenKey}"] = "{$tokenName}";
@@ -14,13 +14,13 @@ function initFilter( id ) {
     remvdArray = new Array();
 
     //get select object
-    selObj = d.getElementById("token"+ id);
+    selObj = document.getElementById("token"+ id);
 
     //rebuild the list
     buildOptions(filterArray);
 
     //clear the input box
-    d.getElementById("filter"+id).value = "";
+    document.getElementById("filter"+id).value = "";
 
     //clear the last typed value
     lastVal = "";
@@ -109,9 +109,9 @@ function buildRemvd( ) {
 
 function getMatches(id) {
     if ( selObj.options.length == 1 ) {
-        d.getElementById("match"+id).innerHTML = "{/literal}{ts}1 match{/ts}{literal}";
+        document.getElementById("match"+id).innerHTML = "{/literal}{ts}1 match{/ts}{literal}";
     } else {
-        d.getElementById("match"+id).innerHTML = selObj.options.length +" {/literal}{ts}matches{/ts}{literal}";
+        document.getElementById("match"+id).innerHTML = selObj.options.length +" {/literal}{ts}matches{/ts}{literal}";
     }
 }
 {/literal}



 

Sunil

  • I post frequently
  • ***
  • Posts: 131
  • Karma: 23
  • The community around a product more important than the product itself?
    • CiviCRM
Re: /templates/CRM/common/Filter.tpl bugfix for review.
October 06, 2009, 12:19:30 am
Hi,

This has been fixed in revision 24035.

Thanks for catching this!

Sunil
The community around a product more important than the product itself?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • /templates/CRM/common/Filter.tpl bugfix for review.

This forum was archived on 2017-11-26.