     (fn []
       [:div.row>div.col-md-12
        [:h2 "Submit a problem"]
-       [:input.form-control
-        {:type :text
-         :placeholder "title"
-         :value (:title @form-data)
-         :on-change (save-input! form-data :title)}]
-       [:input.form-control
-        {:type :text
-         :placeholder "name"
-         :value (:submitter @form-data)
-         :on-change (save-input! form-data :submitter)}]
-       [:textarea.form-control
-        {:placeholder "description"
-         :value (:description @form-data)
-         :on-change (save-input! form-data :description)}]
-       [:div.row>div.col-md-12
-          [editor form-data]]
+       (text-field form-data :title)
+       (text-field form-data :submitter "your name")
+       (textarea form-data :description)
+       [:div.form-group
+        [:div.row>div.col-md-12
+         [editor form-data]]]
        [:div.row
-        [:div.col-md-1>label "Result"]
-        [:div.col-md-11
-        [eval-view eval-result]]]
-       [:button.btn.btn-primary
-        {:on-click #(evaluate-code form-data eval-result)}
-        "evaluate"]
-       [:button.btn.btn-primary
-        {:on-click #(submit-problem form-data result)}
-        "submit"]
+        [:div.form-group
+         [:div.col-md-1>label "Result"]
+         [:div.col-md-11
+          [eval-view eval-result]]]]
+       [:div.form-group
+        [:button.btn.btn-primary
+         {:on-click #(evaluate-code form-data eval-result)}
+         "evaluate"]
+        [:button.btn.btn-primary
+         {:on-click #(submit-problem form-data result)}
+         "submit"]]
        (when-let [result @result]
          [:h2 result])])))
 

         ;:error-handler #(reset! error %)
         }))

(defn submit-problem-form []
  (let [form-data (reagent/atom {})
        result (reagent/atom {})

  (fn [event]
    (swap! form-data assoc id (.. event -target -value))))

(defn fields-present? [form-data fields]
  (not-any? empty? (map @form-data fields)))

(defn submit-problem [form-data result]
  (if-not (fields-present? form-data [:title :submitter :description])
    (js/alert "Required field(s) are missing.")
    (POST "/api/add-example"
      {:params {:problem @form-data}
       :handler #(reset! result %)})))

(defn render-code [this]
  (->> this reagent/dom-node (.highlightBlock js/hljs)))
