This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-23
Channels
- # admin-announcements (25)
- # beginners (3)
- # boot (308)
- # cider (5)
- # clojure (93)
- # clojure-bangladesh (2)
- # clojure-italy (1)
- # clojurescript (63)
- # core-logic (23)
- # datascript (6)
- # editors (1)
- # emacs (2)
- # hoplon (320)
- # incanter (1)
- # jobs (6)
- # jvm (1)
- # melbourne (1)
- # om (2)
- # re-frame (9)
- # reagent (2)
- # slack-help (5)
- # spacemacs (2)
- # yada (1)
I'm trying (unsuccessfully) to use a regex with the re-com input-text component. I've taken the regex expression from the re-com demo page for the input-text component but can't seem to get it to work. When I try and type anything into the textbox, nothing appears. If I remove the :validation-regex key and type into the textbox, the characters appear as expected. What am I doing wrong? The code
(defn main-component []
(let [data (reagent/atom "")
regex (reagent/atom #"^(\\d{0,2})$|^(\\d{0,2}\\.\\d{0,1})$")]
(fn
[]
[v-box
:size "auto"
:gap "10px"
:children
[
[box :width "150px" :child [label :label "Enter data..."]]
[box :child [input-text
:width "300px"
:model data
:on-change #(reset! data %)
:validation-regex @regex
:change-on-blur? false]]
]])))
Is there a free for commercial use db that is commonly used with re-frame instead of datomic?
Looks as though the regex I needed was #"^(-{0,1})(\d{0,2})$". I want the textbox to only accept integers in the range (-99 to +99)
A funny rookie mistake is apparently to forget the hash on an anonymous on-click callback fn. Events started flowing like crazy whenever mouse was moved.
@simax99: regex's catch us all! My favourite place to test these is: https://regex101.com/?#javascript
Also, there are a few more samples for inspiration here: https://github.com/Day8/re-com/blob/master/src/re_com/misc.cljs#L34-L39
@sisawat: re-frame is agnostic of backend database, AFAIK there isn’t any special integration with datomic