             [view {:style card-action-style}
               [text { } @greeting]]]]])))
 
-(defn valid-form? [props] true)
-
-; TODO: Need to get to local/global props to get the 'validation result'
-
-; (defn valid-form? [props]
-;   (js/console.log "valid form?")
-;   (let [validation-result
-;     (.validate (-> props
-;                                          (aget "refs")
-;                                          (aget "form")))]
-;   (empty? (js->clj (aget validation-result "errors")))))
-
-(defn sanitise-form [incident]
-  (if (valid-form? incident)
+(defn valid-form? [props]
+  (let [validation-result (.validate (-> props
+                                         (aget "refs")
+                                         (aget "form")))]
+  (empty? (js->clj (aget validation-result "errors")))))
+
+(defn on-submit [props incident]
+  (when (valid-form? props)
     (js/console.log (clj->js incident))
     (let [value (keywordize-keys (:value incident))
           start_time (:start_time value)

      (t.struct (clj->js (assoc obj :id t.Number)))
      (t.struct (clj->js obj)))))

; ; TODO: Move state into GLOBAL app state, not confined to component
;
(def style
  {

                 :font-weight "bold"}
   })

; ; TODO: Move state into GLOBAL app state, not confined to component
(defn edit-incident-form []
 (fn []
  (r/create-class
    {:component-will-mount
     (fn [this]
       (let [incident (subscribe [:current-incident])
             start_time (:start_time @incident)
             end_time   (:end_time @incident)
             students   (:students @incident)
             id         (:id @incident)
             local_id   (:local_id @incident)
         ; Convert string to Date objects, and extract student id's
         updated (-> @incident
             (assoc :students (into [] (map #(:id %1) students)))
             (assoc :local_id (if (and (nil? id) (nil? local_id))
                                  (.now js/Date)
                                  (if-not (nil? local_id) local_id id)))
             (assoc :start_time (js->clj (if (nil? start_time) (new js/Date) (new js/Date start_time))))
             (assoc :end_time (js->clj (if (nil? end_time) (new js/Date) (new js/Date end_time)))))]
         (r/set-state this {:value updated})))

     :reagent-render
     (fn [props]
       (this-as this
                (let [{:keys [value]} (r/state this)]
                (js/console.log "Updated model: " (clj->js value))
                   [view {:style (:form-container styles)}
                    [scroll
                     {:style (:scroll-container styles)}
                     [Form {:ref "form"
                            :type (incident value)
                            :value value
                            :options options
                            :on-change #(r/set-state this {:value (js->clj %1)})}]
                      [touchable-highlight
                        {:style      (style :button)
                        :disabled?    #(not (valid-form? props))
                        :on-press    #(js/console.log "touchable-highlight")}
                        [text {:style (style :button-text)} "Save Incident"]]

                            ]])))})))
