Closed acim1 closed 6 years ago
The reason is that the :id
represents a path into the document. If you change your select :id
key to be :calendar.id
, then you'll see (:calendar :id)
as the first argument.
I'm open to switching this to pass in the original id keyword instead so that you'd get :calendar.id
instead of :(calendar :id)
. That might be a more intuitive behavior.
Just released 0.5.43
with the new API for events. The new version event handler signature accepts the following arguments:
(fn [id path value doc]
(println id doc)
(case id
:calendar.day
(assoc-in doc [:result :status] :hello)
value))
The path
contains the path for looking up the field in the document, and the id
contains the :id
of the field in the form.
https://github.com/reagent-project/reagent-forms#adding-events
For the below component, the "id" parameter supplied in the event function was actually a sequence (or
(:day)
, when changing the day). That's why I changed the name toids
to make it less confusing for myself, and updated the logic accordingly. The given is what worked to fire the event when changing day: