Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reagent-Forms radio buttons displaying as text fields

I am trying to display a group of radio buttons in a reagent/cljs app. I have followed the same process from http://yogthos.github.io/reagent-forms-example.html but the radio buttons I am displaying are showing up as textfield input boxes.

(def ^:private options (atom nil))

(defn set-options []
(reset! options
      [{:name "label name"}
       {:name "label name"}
       {:name "label name"}])) 


(defn set-radio-buttons []
 (set-options)
   (for [option @options]
      [:div.radio
        [:label
          [:input {:field :radio}]
             (option :name)]]))



  (defn response-box []
    [:div#response
       (set-radio-buttons)])

I am then placing response-box in the ui layer of the app.

Thanks

like image 396
Michael Thurmond Avatar asked Dec 30 '25 10:12

Michael Thurmond


1 Answers

Field is not a correct input element attribute.

[:input {:field :radio}]
         (option :name)]]))

Should probably be

[:input {:type :radio}]
         (option :name)]]))
like image 51
Joost Diepenmaat Avatar answered Jan 02 '26 00:01

Joost Diepenmaat