cvs: pear /HTML_QuickForm_advmultiselect qfamsHandler.js

[email protected] ("Laurent Laville")
Newsgroups php.pear.cvs
Message-ID <cvsfarell1209216249@cvsserver>
farell		Sat Apr 26 13:24:09 2008 UTC

  Modified files:              
    /pear/HTML_QuickForm_advmultiselect	qfamsHandler.js 
  Log:
  bug fix: liveCounter is break (not initialized) 
  when you have more than once QF ams element on the same page, on swap one list to checkbox version
  
  See qfams_multiple2.php script (Mulitple 2 example as demo)
  
http://cvs.php.net/viewvc.cgi/pear/HTML_QuickForm_advmultiselect/qfamsHandler.js?r1=1.3&r2=1.4&diff_format=u
Index: pear/HTML_QuickForm_advmultiselect/qfamsHandler.js
diff -u pear/HTML_QuickForm_advmultiselect/qfamsHandler.js:1.3 pear/HTML_QuickForm_advmultiselect/qfamsHandler.js:1.4
--- pear/HTML_QuickForm_advmultiselect/qfamsHandler.js:1.3	Sat Apr 26 12:16:09 2008
+++ pear/HTML_QuickForm_advmultiselect/qfamsHandler.js	Sat Apr 26 13:24:09 2008
@@ -6,7 +6,7 @@
  * @author     Laurent Laville <[email protected]>
  * @copyright  2007-2008 Laurent Laville
  * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
- * @version    CVS: $Id: qfamsHandler.js,v 1.3 2008/04/26 12:16:09 farell Exp $
+ * @version    CVS: $Id: qfamsHandler.js,v 1.4 2008/04/26 13:24:09 farell Exp $
  * @since      File available since Release 1.3.0
  */
 
@@ -25,9 +25,11 @@
     if (window.qfamsName) {
         for (var e = 0; e < window.qfamsName.length; e++) {
             var div    = document.getElementById('qfams_' + window.qfamsName[e]);
-            var inputs = div.getElementsByTagName('input');
-            for (var i = 0; i < inputs.length; i++) {
-                inputs[i].onclick = qfamsUpdateLiveCounter;
+            if (div !== null) {
+                var inputs = div.getElementsByTagName('input');
+                for (var i = 0; i < inputs.length; i++) {
+                    inputs[i].onclick = qfamsUpdateLiveCounter;
+                }
             }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.