       beforeSubmit: (data) ->
         console.log "Sending these data to the server: #{$.param(data)}"
 
+  setFormStep($form)
+
   $form.bind "step_shown", (event, data) ->
+    setFormStep($form)
+
     if data.previousStep is data.firstStep
       console.log("Adding additional Ajax events")
       # adds additional Ajax events now that we have the update URL


  wizard_buttons = '<input type="reset" /><input type="submit" />'
  $fieldsets.find("div.buttons").html wizard_buttons

  $form.formwizard
    formPluginEnabled: true,

        console.log "Sending these data to the server: #{$.param(data)}"
      success: (data) ->
        console.log "Successful form POST; got #{$.param(data)}"
        setFormAction($form, data.ht)
  remoteAjax

$ ->
  $form = $("form.wizard")

  $fieldsets = $form.find "fieldset"

