       $radio.find("[value=\"#{value}\"]").attr("checked", "checked")
 
   setFormFields: (model) ->
+    # console.log "Setting form fields based on: #{JSON.stringify(model)}"
     this.fillTextFields(model)
     this.setSelectFields(model)
     this.setCheckboxes(model)


  repeatStep: (step) ->
    $sourceStep = this.findStep(step.repeatOf.fieldset)
    console.log "Cloning repeated step #{step.repeatOf.fieldset}"
    $clonedStep = $sourceStep.clone(true, true)
    $clonedStep.css("display", "none")
    $clonedStep.attr("id", step.name)

      url: @form.attr("action"),
      dataType: "json",
      beforeSubmit: (data) =>
        # console.log "Sending these data to the server: #{JSON.stringify(data)}"
        true
      success: (response) =>
        # console.log "Successful form POST; got #{JSON.stringify(response)}"
        if response.metadata?
          this.setAction(response.metadata.url, response.metadata.method)
        $.extend(window.hatTrick, response) # merge new data with hatTrick
