Skip to content

Commit

Permalink
Set value to an empty string in case the date is nil
Browse files Browse the repository at this point in the history
This change in React facebook/react#5013
causes the warning message if the value of an input is null.
  • Loading branch information
asok committed Oct 28, 2016
1 parent d5b7dae commit 6a8d2ea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/reagent_forms/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@

(defmethod bind :input-field
[{:keys [field id fmt]} {:keys [get save! doc]}]
{:value (let [value (or (get id) "")]
(format-value fmt value))
{:value (if-let [value (or (get id) "")]
(format-value fmt value)
"")
:on-change #(save! id (->> % (value-of) (format-type field)))})

(defmethod bind :checkbox
Expand Down Expand Up @@ -169,7 +170,9 @@
:on-click #(do
(.preventDefault %)
(swap! expanded? not))
:value (when-let [date (get id)] (format-date date fmt))}
:value (if-let [date (get id)]
(format-date date fmt)
"")}
(clean-attrs attrs))]
[:span.input-group-addon
{:on-click #(do
Expand Down

0 comments on commit 6a8d2ea

Please sign in to comment.