diff --git a/sites/all/modules/contrib/date/date_repeat/date_repeat_form.inc b/sites/all/modules/contrib/date/date_repeat/date_repeat_form.inc
index 9cef000..65611c6 100644
--- a/sites/all/modules/contrib/date/date_repeat/date_repeat_form.inc
+++ b/sites/all/modules/contrib/date/date_repeat/date_repeat_form.inc
@@ -944,7 +944,15 @@ function theme_date_repeat_rrule($vars) {
   $class = $element['#date_repeat_collapsed'] ? array('date-no-float', 'collapsible', 'collapsed') : array('date-no-float', 'collapsible');
   $id = drupal_html_id('repeat-settings-fieldset');
   $parents = $element['#parents'];
-  $selector = "{$parents[0]}[{$parents[1]}][{$parents[2]}][show_repeat_settings]";
+  $selector = str_replace('_', '-', "edit-{$parents[0]}-{$parents[1]}-{$parents[2]}-show-repeat-settings");
+  // The forms API will append "--2", "--3", etc. to fields to prevent name clashes.
+  // This code tests for existence of this "$last_part" of the form id, and, if it
+  // exists, appends it to the $selector.
+  $last_part = strpos($id, '--');
+  if ($last_part !== FALSE) {
+    $i = substr($id, $last_part);
+    $selector .= $i;
+  }
   $fieldset = array(
     '#type' => 'item',
     '#title' => t('Repeat settings'),
@@ -953,7 +961,7 @@ function theme_date_repeat_rrule($vars) {
     '#markup' => $element['#children'],
     '#states' => array(
       'visible' => array(
-        ":input[name=\"{$selector}\"]" => array('checked' => TRUE),
+        ":input[id=\"{$selector}\"]" => array('checked' => TRUE),
       ),
     ),
     '#id' => $id,
