 (defn button [value fun]
   [:button.btn.btn-primary {:on-click fun} value])
 
-(defn form-save [data-set focus]
+(defn add-form-onclick [data-set focus]
   (if (= nil (form-validator @data-set))
     (let [onres (fn[json]
                   (do

                                 [render-documents (get-new-page-data (get-value! :documents)
                                                                      (get-value! :current-page))])))]
    (http-get "http://localhost:8193/documents/all" onres)))

(defn click-update[id]
  (secretary/dispatch! (str "#/documents/update/" id)))

;; (defn docupdate [event]
;;   (let [onres (fn[data]
;;                 (secretary/dispatch! "/documents"))]
;;     (http-post "http://localhost:8193/documents/update"
;;                onres (.serialize (Serializer.) (clj->js (get-update-documents-formdata))))))

(defn delete[id]
  (let [onres (fn [json]
                (do
                  (set-key-value :documents (getdata json))
                  (set-key-value :page-location
                                 [render-documents (get-new-page-data (get-value! :documents)
                                                                      (get-value! :current-page))])))]
    (http-delete (str "http://localhost:8193/documents/delete/" id)  onres)))

(defn add [event]
  (secretary/dispatch! "/documents/add"))

(defn render-documents [documents]
  [:div

                                           (get-value! :current-page))]))))

;; ========================================================================================
;; Add-update-form creation validation
;; ========================================================================================

(defn form-validator [data-set]
