bilus / reforms

Beautiful Bootstrap 3 forms for Om, Reagent and Rum.
Eclipse Public License 1.0
168 stars 7 forks source link

Setting maxlength on a text input #13

Closed alexander-rymasheusky closed 3 years ago

alexander-rymasheusky commented 8 years ago

How can I set maxlength attribute on a label? Tried these ways and none worked:

(ns app.my-views
    (:require [reforms.reagent :include-macros true :as f]))

(defn component []
  (let [data (atom {})
        on-submit #(debug "on-submit")]
    (fn []
      [:div
       (f/form {:on-submit on-submit}
               [:input {:type "text" :max-length 4}] ;; <-- This works as expected, ie maxlength is set in the DOM
               (f/text "Comment:" data [:comment]
                       :maxlength 1 :max-length 2 :attrs {:maxlength 3 :max-length 4})
               )])))

FWIW, I'm using Reagent.