       @form.trigger "other_button_click", clickCallbackData
     $button
 
+  setButton: (stepId, toStep, button) ->
+    $buttonsDiv = $("fieldset##{stepId}").find("div.buttons")
+    if $buttonsDiv.find("button").length > 0
+      @lastButtonChanged ?= $buttonsDiv.find("button").first
+    buttonSelector = """button[name="#{button.name}"][value="#{button.value}"]"""
+    $existingButtons = $buttonsDiv.find(buttonSelector)
+    if $existingButtons.length is 0
+      $newButton = $(this.createButton(toStep, button))
+      if @lastButtonChanged?
+        @lastButtonChanged.after $newButton
+      else
+        $buttonsDiv.append $newButton
+      @lastButtonChanged = $newButton
+      $newButton.click (event) =>
+        event.preventDefault()
+        fieldId = "button_#{$newButton.attr("name")}_#{$newButton.val()}_field"
+        this.setHiddenInput $newButton.attr("name"), $newButton.val(), fieldId, "", $buttonsDiv
+        this.goToStepId(toStep)
+
   # TODO: DRY this up
-  setButton: (stepId, toStep, button) ->
+  setButtonOld: (stepId, toStep, button) ->
     $buttonsDiv = $("fieldset##{stepId}").find("div.buttons")
     @lastButtonChanged ?= $buttonsDiv.find("button").first
     switch toStep

    this.setRadioButtons(model)

  createButtonElement: (name, value, label, type="button") ->
    $elem = $("""<button type="#{type}" class="wizard_button" name="#{name}"></button>""")
    $elem.html label
    $elem.val value
    $elem

  createButton: (toStep, button) ->
    $button = this.createButtonElement button.name, button.value, button.label
    if button.id?
      $button.attr("id", button.id)
    else
      $button.attr("id", "#{this.currentStepId()}_#{button.name}_#{button.value}")
    if button["class"]?
      $button.addClass(button["class"])


  stepShownCallback: ->
    currentStepId = this.currentStepId()

    @lastButtonChanged = null

    if hatTrick.stepMetadata[currentStepId]?
      hatTrick.metadata.currentStep = hatTrick.stepMetadata[currentStepId]
