This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-02
Channels
- # adventofcode (47)
- # announcements (7)
- # aws (1)
- # babashka (52)
- # beginners (80)
- # boot (3)
- # calva (19)
- # cider (9)
- # cljs-dev (1)
- # clojure (48)
- # clojure-brasil (1)
- # clojure-dev (27)
- # clojure-europe (3)
- # clojure-madison (3)
- # clojure-nl (29)
- # clojure-spec (11)
- # clojure-sweden (1)
- # clojure-uk (49)
- # clojurescript (66)
- # core-async (20)
- # cryogen (4)
- # cursive (13)
- # data-science (7)
- # datomic (5)
- # emacs (30)
- # figwheel-main (11)
- # fulcro (15)
- # graphql (8)
- # jobs (5)
- # joker (17)
- # lambdaisland (1)
- # leiningen (2)
- # malli (2)
- # off-topic (5)
- # pathom (22)
- # re-frame (12)
- # reagent (29)
- # reitit (2)
- # ring (10)
- # shadow-cljs (57)
- # specter (3)
- # tools-deps (22)
- # vim (5)
- # xtdb (7)
is there a good explanation for why the notation for accessing properties of the react event object is .-<property>
?
potential gotcha I've learned / cargo-culted ... using (.-a-property foo)
tends to be a source of a lot of my advanced compilation issues because the closure compiler may or may not have enough visibility. Since I don't quite understand when that is, I've started to use (goog.object/getValueByKeys foo "a-property")
in general when accessing objects that aren't mine, since (as I understand it) GCC won't rename strings and this effectively it tells it to back off from aggressively renaming it.
@U08BW7V1V This may be of interest to you: https://code.thheller.com/blog/shadow-cljs/2017/11/06/improved-externs-inference.html
I think I read it when Thomas wrote it, but the full implications have been a while sinking in.
Hello. i have a html input field and would like to put a required tag on it. I would like to know if it's possible.
{:value (get-in @current [:addresses address-type id]) :type type :on-change on-change-action :disabled disabled? :required}
This is my current tryBy "no" you mean it was not added to the list of the <input>
attributes at all? Or that it did not show any pop-up when you didn't enter anything and tried to submit the form?
Second sentence
In html, it appears the required tag
OK. Did you actually build a proper <form>
? Can you show the code that renders the form and includes anything that's relevant?
Maybe the thing was this form, probably it's not well formed
It has to be a proper <form>
, with a proper <button>
that submits the form. More details and examples: https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation#The_required_attribute
All right
I found out what was going on.
The submit button was executing the :on-click
in the same time that the field was validated.
I looking foward on how to execute the validation before execute the save function.
The intended way to use HTML's form validation is not to bypass form's submission but to use it.
I would move the button's :on-click
handler to the form's :on-submit
handler. Since you're probably writing an SPA application, you'll need to call preventDefault
on the event passed in that handler.
How I've done it in a login form once:
[:form {:on-submit (fn [e]
(.preventDefault e)
(dispatch [::mae/login @login @password]))}
...]
And it will only dispatch when all required fields are fullfiled
Right?
I think so, yes. :on-submit
should be called only if all fields are valid. You can easily check it.
Worked. Thanks