This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-17
Channels
- # announcements (1)
- # aws (7)
- # babashka (5)
- # calva (56)
- # cider (13)
- # clj-commons (1)
- # clj-kondo (12)
- # clj-yaml (35)
- # clojure (84)
- # clojure-europe (93)
- # clojure-sg (2)
- # clojure-uk (1)
- # clojurescript (10)
- # conjure (37)
- # core-typed (1)
- # cursive (31)
- # duct (1)
- # figwheel-main (4)
- # fulcro (2)
- # holy-lambda (2)
- # humbleui (3)
- # membrane (118)
- # off-topic (46)
- # pathom (8)
- # podcasts-discuss (5)
- # releases (2)
- # rewrite-clj (13)
- # sci (27)
- # shadow-cljs (17)
- # tools-deps (12)
I just returned to a fulcro project after a year away, updated to the latest stable version, and was thrilled to find it build and run great!
However, the problem I’m seeing is still present: I’m having an issue with a :decimal
Rad semantic-ui form field that won’t accept a negative value. When the “-” is entered, the cursor jumps to the end of the field. Anyone else seen this? I’m using the default renderer from : decimal-field/render-field
If I use the :USD
renderer, then the minus shows, so it appears to be a problem with the default decimal renderer.
UPDATE: it looks like the problem is the :string-filter
in the default decimal renderer. If I remove the replace, like the :USD
, then it works
(def ui-decimal-input
(comp/factory (inputs/StringBufferedInput ::DecimalInput
{:model->string (fn [n] (math/numeric->str n))
:string->model (fn [s] (math/numeric s))
:string-filter (fn [s] (str/replace s #"[^\d.]" ""))})))
FIXED:
:string-filter (fn [s] (first (re-find #"^-?\d*(\.\d*)?" s)))
I submitted a [PR](https://github.com/fulcrologic/fulcro-rad-semantic-ui/pull/27)xposting because I think this might be used by Fulcro? https://clojurians.slack.com/archives/CE08R3QAU/p1663429274159529