From fce6d29bdf08b3256a471840b3b1e99e59d6d6a9 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sun, 30 Sep 2018 23:28:50 +0200 Subject: [PATCH] hidden widgets do not get a label anymore --- src/formulare/core.clj | 3 ++- test/formulare/core_test.clj | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/formulare/core.clj b/src/formulare/core.clj index 7c1ea2e..2ff581d 100644 --- a/src/formulare/core.clj +++ b/src/formulare/core.clj @@ -118,7 +118,8 @@ (list (when (and validate? (not (spec/valid? spec req-value))) (spec-to-errmsg label spec req-value)) - (hform/label id label) + (when-not (= :hidden widget) + (hform/label id label)) (renderer id def (if validate? req-value value))))) (defn form-hash [def values] diff --git a/test/formulare/core_test.clj b/test/formulare/core_test.clj index 64dbb15..c0949a4 100644 --- a/test/formulare/core_test.clj +++ b/test/formulare/core_test.clj @@ -190,7 +190,7 @@ (let [def {:fields {:foo-id {:label "foo-label" :widget :hidden}}}] (is (= (list nil - [:label {:for "foo-id"} "foo-label"] + nil [:input {:id "foo-id" :type "hidden" :name "foo-id" @@ -202,7 +202,7 @@ (let [def {:fields {:foo-id {:label "foo-label" :widget :hidden}}}] (is (= (list nil - [:label {:for "foo-id"} "foo-label"] + nil [:input {:id "foo-id" :type "hidden" :name "foo-id"