                        :nameofthefirstparty [[v/required :message "Field is required"]]
                        :nameofthesecondparty [[v/required :message "Field is required"]]
                        :dateofinstitution [[v/required :message "Field is required"]
-                                           [year-after? :message "Year must greater than 1900"]
-                                           [year-before? :message "Year must less than 9999"]]
+                                           [date-year-after? :message "Year must greater than 1900"]
+                                           [date-year-before? :message "Year must less than 9999"]]
                        :nameofpo [[v/required :message "Field is required"]]
                        :dateofdecision [[v/required :message "Field is required"]
-                                        [year-after? :message "Year must greater than 1900"]
-                                        [year-before? :message "Year must less than 9999"]]
+                                        [date-year-after? :message "Year must greater than 1900"]
+                                        [date-year-before? :message "Year must less than 9999"]]
                        :title [[v/required :message "Field is required"]]
                        :khasranumber [[v/required :message "Field is required"]]
                        :khatakhatuninumber [[v/required :message "Field is required"]]

                           [:b (str (first ((o6register-form-validator @data-set) id)))]])
                        [:div])]])))


(defn set-o6-fields [data-set mutdata]
  (do
    (swap! data-set assoc :subdivisionname (.-subdivisionname mutdata))
    (swap! data-set assoc :mutationid (int (.-id mutdata)))
    (swap! data-set assoc :villagename (.-villagename mutdata))))


(defn reset-o6-fields [data-set]
  (do
    (swap! data-set assoc :subdivisionname nil)
    (swap! data-set assoc :mutationid nil)
    (swap! data-set assoc :villagename "")
    (swap! data-set assoc :o6number nil)))

(defn on-o6-change [data-set]
  (let [selval (.-value (.getElementById js/document "O6-select"))
        onres (fn [json] (let [d (first (getdata json))]
                          (set-o6-fields data-set d)))]
    (if (= selval "select") (reset-o6-fields data-set)
        (http-get-auth (str serverhost "o6registers/"selval"/mutations")
                       onres))))


(defn o6-select
  [data-set]
  [:div.form-group
   [:label.col-sm-3.control-label "O6 Number"]
   [:div.col-sm-6
    [:select.form-control {:id "O6-select" :value (:o6number @data-set) :on-change #(on-o6-change data-set)}
     (for [d (get-value! :o6mutations)]
       ^{:key (.-id d)} [:option {:value (.-o6number d)} (.-o6number d)])]]])


(defn o6register-form-cancel [event]
  (accountant/navigate! "/o6register"))


(defn o6register-tags-template [data-set]
  [:select.form-control {:id "o6register-districts" :value (:villagename @data-set)}
   (doall (for [d (get-value! :villages)]
            ^{:key (.-id d)} [:option {:value (.-villagename d)} (.-villagename d)]))])

(defn o6register-input-select [label data-set focus]
  (let [input-focus (r/atom nil)]
    (fn []
      [:div.form-group
       [:label.col-sm-3.control-label label]
       [:div#tagdiv.col-sm-6 [o6register-tags-template data-set]]
       [:div.col-sm-3 [:div]]])))

(defn o6register-template [doc-name data-set focus save-function]
  [:div.container

            [:div]
            [:div {:style  {:color "red"}} [:b (str (first ((login-validator @data-set) id)))]])
          [:div])])))
          


          (defn submit-login [data-set focus]
            (if (= nil (login-validator @data-set))
              (let [onresp (fn [json]
                             (if (= (get-status json) 200)
                               ((set-key-value :user (.-_2 (getdata json)))
                                (set-key-value :token (.-_1 (getdata json)))
                                (set-item local-storage "session" {:current-url "/" :user-info
                                                                   {:token (get-value! :token)
                                                                    :user (get-value! :user)}})
                                (reset-login-page)
                                (accountant/navigate! "/"))))]
                (http-post (str serverhost "login") onresp (.serialize (Serializer.) (clj->js @data-set ))))
              (reset! focus "on")))




(defn submit-button [data-set focus]
  [:div.row
