       elementName = $element.attr("name")
       if elementName? and elementName.search(@fieldRegex) isnt -1
         [_, modelName, fieldName] = elementName.match(@fieldRegex)
-        if model[fieldName]?
+        if model['__name__'] is modelName and model[fieldName]?
           fieldValue = model[fieldName]
           callback($element, fieldValue) if fieldValue?
 

        buttonSelector = """input:button[name="#{name}"][value="#{button.label}"]"""
        $existingButtons = $buttonsDiv.find(buttonSelector)
        if $existingButtons.length is 0
          # console.log "Adding new #{name}:#{button.label} button"
          $newButton = $(this.createButton(name, button)).appendTo($buttonsDiv)
          $newButton.click (event) =>
            event.preventDefault()

    result += "_#{matches[1].toLowerCase()}#{matches[2]}"
  result = string unless result?
  result

log = (msg) ->
  if window['console']?
    console.log msg
