Index: conditional_fields.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/conditional_fields/conditional_fields.js,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 conditional_fields.js
--- conditional_fields.js	11 Jan 2008 12:13:59 -0000	1.1.2.10
+++ conditional_fields.js	4 Feb 2008 16:16:26 -0000
@@ -1,34 +1,27 @@
-// $Id:$
+/* $Id$ */
 
 if (!Drupal.ConditionalFields) {
   Drupal.ConditionalFields = {};
 }
 
 Drupal.ConditionalFields.switchField = function(id, values) {
-  // For each controlling field:
-  // Find the controlled fields
+  /* For each controlling field: find the controlled fields */
   $.each(Drupal.settings.ConditionalFields.controlling_fields, function(controllingField, controlledFields) {
     if (controllingField == id) {
       var isActive = false;
-      // Find the settings of the controlled field
+      /* Find the settings of the controlled field */
       $.each(controlledFields, function(i, fieldSettings) {
-        $(fieldSettings.field_id).show();
-        // Find the trigger values of the controlled field (for this controlling field)
+        $(fieldSettings.field_id).hide();
+        /* Find the trigger values of the controlled field (for this controlling field) */
         $.each(fieldSettings.trigger_values, function(ii, val) {
           if (Drupal.ConditionalFields.inArray(val, values) != -1) {
-            isActive = true;
+            $(fieldSettings.field_id).show();
+            /* Stop searching in this field */
             return false;
           }
         });
-        // If there is an active trigger key in this controlling field, stop searching
-        if (isActive == true) {
-          return false;
-        }
-        // To do: feature. This would multiple controlling fields on the same field, but they are
-        // not supported for now. I should try other controlling fields.
-        else {
-          $(fieldSettings.field_id).hide();
-        }
+        /* To do: feature. Multiple controlling fields on the same field, are
+           not supported for now. I should try other controlling fields. */
       });
     }
   });
@@ -37,20 +30,27 @@ Drupal.ConditionalFields.switchField = f
 Drupal.ConditionalFields.findValues = function(field) {
   var values = [];
   field.find("option:selected, input:checked").each( function() {
-    values[values.length] = this.value;
+    if ($(this)[0].selected || $(this)[0].checked) {
+      values[values.length] = this.value;
+    }
   });
   return values;
 }       
         
 Drupal.ConditionalFields.docReady = function() {
-  //Set default state  
+  /* Set default state */
   $('.controlling-field').each(function() {
     var values = Drupal.ConditionalFields.findValues($(this));
     var id = '#' + $(this).attr('id');
     Drupal.ConditionalFields.switchField(id, values);
   });
-  // Add events
-  $('.controlling-field').change(Drupal.ConditionalFields.fieldChange);
+  /* Add events. Apparently, Explorer doesn't catch the change event? */
+  if ($.browser.msie == true) {
+    $('.controlling-field').click(Drupal.ConditionalFields.fieldChange);
+  }
+  else {
+    $('.controlling-field').change(Drupal.ConditionalFields.fieldChange);
+  }
 }
 
 Drupal.ConditionalFields.fieldChange = function() {
@@ -59,6 +59,10 @@ Drupal.ConditionalFields.fieldChange = f
   Drupal.ConditionalFields.switchField(id, values);
 }
 
+/**
+ * This is the same function from latest jQuery
+ * http://code.jquery.com/jquery-latest.js
+ */
 Drupal.ConditionalFields.inArray = function( elem, array ) {
   for ( var i = 0, length = array.length; i < length; i++ )
     if ( array[ i ] == elem )
