 ;; Events
 ;;------------------------------------------------------------------------------
 
+;; TODO: what to do when they don't input a username? validation?
 (defn on-submit
   "Handle the submit event."
-  []
-  (let [input (.val ($ ".login-name"))]
+  [e]
+  (.preventDefault e)
+  (let [input (.val ($ "#login"))]
     (store-login! input)
     (send-login!)
     (aset js/location "hash" "#/menu")))

(hiccups/defhtml login-html []
  [:div#inner-container.login
    [:div.login-container
      [:label "What is your name?"]
      [:input.login-name {:type "text"}]
      [:button#submit.lg-btn "OK"]]])

;;------------------------------------------------------------------------------
;; Username storage.

;; Page Initialization
;;------------------------------------------------------------------------------

(defn init []

  ; Initialize page content
  (.html ($ "#main-container") (login-html))

  ; Populate username field.
  (.val ($ "#login") (get-username))

  ; Set username on button click.
  (.click ($ "#submit") on-submit)

  ; Put focus on username field.
  (.focus (by-id "login")))

(defn cleanup
  []
