     $triggerElement.on "change", ->
       # pop out of condition into rules to handle all conditions defined in the rule
       # TODO it seems this is looping through ALL data-rule in the DOM instead of the data-rule associated with the element that triggered the onchange event-kdh
-      $("[data-rule]").each ->
+      $($triggerElement).closest(".form-container-repeater").find("[data-rule]").each ->
         $ruleElement = $(this)
+        $container = $(this).closest(".form-container-repeater")
         rule = $.parseJSON($ruleElement.attr("data-rule")).rule_hash
         matchType = rule.match_type
         questionId = $triggerElement.closest('.form-container-entry-item').attr('data-question-id')

    # match type any (or)
    if matchType == "any"
      if _.indexOf(conditionMetTracker, true) > 0
        self.hideShowQuestions(false, ancestorId, $ruleElement)
      else
        self.hideShowQuestions(true, ancestorId, $ruleElement)
    # match type all
    if matchType == "all"
      if _.indexOf(conditionMetTracker, false) == -1
        self.hideShowQuestions(false, ancestorId, $ruleElement)
      else
        self.hideShowQuestions(true, ancestorId, $ruleElement)


  #hide or show questions
  hideShowQuestions: (hide_questions, ancestor_id, $ruleElement) ->
    container = $ruleElement.closest('.form-container-survey').find(".form-container-repeater[data-question-id=" + ancestor_id + "],[data-question-id=" + ancestor_id + "],[data-ancestor=" + ancestor_id + "]")
    if hide_questions
      container.addClass("conditional-logic-hidden")
      self.clearQuestions(container)
    else
      container.removeClass("conditional-logic-hidden")

  #clear questions
  clearQuestions: (container) ->

      #console.log rule
      $(rule.conditions).each ->
        $ruleElement = $ruleElement
        $container = $($ruleElement).closest(".form-container-repeater")
        condition = this
        #console.log condition
        questionId = condition.question_id
        #TODO: this shit needs to be context specific yo

        #  all_questions = $container
        #  all_questions << $($container).find(".form-container-repeater[data-question-id=" + ancestor_id + "],[data-question-id=" + ancestor_id + "],[data-ancestor=" + ancestor_id + "]")

        $triggerContainer = $ruleElement.closest('.form-container-survey').find("[data-question-id=" + questionId + "]")
        # getting element on edit and new page
        $triggerElement = $triggerContainer.find(".form-control")
