           else
             if $conditionElement.is(":checkbox")
               # limit binding of each checkbox if data-label-value and answer are the same-kdh
-              $conditionElement = $conditionContainer.find(".form-control[data-label-value='" + condition.answer.replace("/","\\/").replace("'","\\'") + "']")
+#              $conditionElement = $conditionContainer.find(".form-control[data-label-value='" + condition.answer.replace("/","\\/").replace("'","\\'") + "']")
               self.bindConditions($conditionElement, rule)
             else
               for element in $conditionElement

          return $conditionElement.val()
      else
        return
    if $conditionElement.is('select[multiple]')
      if $conditionElement.siblings(".chosen-container").find(".chosen-choices li span").size() > 0
        option_strings = []
        $conditionElement.siblings(".chosen-container").find(".chosen-choices li span").each ->
          option_strings.push this.innerHTML
        return option_strings.join("|&|")
      else if $conditionElement.is(".selectize-taxon-select") && $conditionElement.children().size() > 0


  updateCalculation: (rule) ->
    parameters = {}
    console.log('calculated field update triggered for: ' + rule.question_id)

    $.each rule.conditions, (index, condition) ->

      $question = $('[data-question-id="' + condition.question_id + '"]')

      elementType = $question.data('element-type')
      columnName = $question.data('api-column-name')

      $repeater = $question.closest(".form-container-repeater")

      if $repeater.length > 0
        entries = []

        $.each $question, (index, entry) ->
          value = self.getNativeValue($(entry).find('.form-control'), elementType)
          entries.push value

        parameters[columnName] = entries

      else
        $conditionElement = $question.find('.form-control')
        value = self.getNativeValue($conditionElement, elementType)
        parameters[columnName] = value

    console.log(parameters)

  getNativeValue: ($input, elementType) ->
    stringValue = self.getValue($input)

    if elementType == 'checkbox'
      return stringValue == 'true'

    if elementType == 'number' || elementType == 'counter'
      if $.isNumeric(stringValue)
        return parseFloat(stringValue)
      else
        return 0

    if elementType == 'multiselect' || elementType == 'checkboxes'
      if stringValue == undefined || stringValue == null || stringValue.trim() == ''
        return []
      else
        return stringValue.split('|&|')

    if elementType == 'date'
      return $input.datepicker('getDate')

    if stringValue == undefined || stringValue == null || stringValue.trim() == ''
      return null

    return stringValue

$ ->
  if $('input#survey_survey_template_id').length
