reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Radio buttons don't work with React 0.13.1 #56

Closed erikcw closed 8 years ago

erikcw commented 9 years ago

The ":name" field of the radio button component causes Reagent to blowup with this error:

Uncaught Error: Doesn't support name:

Here is the stack trace:

reagent$impl$util$render_component (VM34543 util.js:287)
reagent.core.render.cljs$core$IFn$_invoke$arity$3 (core.js:144)
reagent$core$render (core.js:127)
reagent.core.render.cljs$core$IFn$_invoke$arity$2 (core.js:137)
reagent$core$render (core.js:123)
simple$views$page (views.cljs:931)
action__25036__auto___35249 (views.cljs:938)
secretary$core$dispatch_BANG_ (core.js:669)
simple$routes$setup_routing (routes.js:84)
simple$core$main (core.cljs:30)
(anonymous function) (dev.cljs:16)

I tested with the following (copied from the reagent-forms demo to be sure I wasn't mistyping...):

(defn radio [label name value]
  [:div.radio
   [:label
    [:input {:field :radio :name name :value value}]
    label]])

    (radio "Region" :radiotest :region)
    (radio "Zip" :radiotest :zip)

reagent-forms 0.5.1 reagent 0.5 React.js 0.13.1

yogthos commented 9 years ago

I'm not able to repruce the issue, below code works as expected:

(defn radio [label name value]
  [:div.radio
   [:label
    [:input {:field :radio :name name :value value}]
    label]])

(defn home-page []
  (let [doc (atom {})]
    (fn []
      [:div
       [bind-fields
        (radio "Region" :radiotest :region)
        doc]
        [:p (str @doc)]])))

the example from the docs appears to work correctly as well:

(defn home-page []
  (let [doc (atom {})]
    (fn []
      [:div
       [bind-fields
        [:div
         [:input {:field :radio :value :a :name :radioselection} "foo"]
         [:input {:field :radio :value :b :name :radioselection} "bar"]
         [:input {:field :radio :value :c :name :radioselection} "baz"]]
        doc]
        [:p (str @doc)]])))

Using the same deps in my project.clj

[reagent "0.5.0"]
[reagent-forms "0.5.1"]
[cljsjs/react "0.13.1-0"]