I have issue with this simple radio button example.

I want to select the value with the keyboard. But When I am navigating with the 
keyboard between the radio buttons the focus is lost... Anyone has a idea why ?


(defonce app-state
         (atom
           {:values ["label1" "label2" "label3"]}))

(defn checked? [value option]
  (and (= value option) "checked"))

(defn form-view [data owner]
  (reify
  om/IInitState
  (init-state [_]
    {:answers {"test" "label2"}})
  om/IRenderState
  (render-state [this state]
    (apply dom/span nil 
      (om/build-all 
        (fn [option]
          (reify
            om/IRender
            (render [this]
              (dom/label nil option
                (dom/input #js {:checked (checked? (get (:answers state) 
"test") option)
                                :type "radio"
                                :name "test"
                                :value option
                                :onChange
                                       #(let [new-value (-> % .-target .-value)]
                                          (when (js/isNaN new-value)
                                            (om/update-state! owner :answers
                                                  (fn [xs]
                                                    (assoc xs "test" 
new-value)))))})))))
        (:values data))))))



(om/root form-view app-state
  {:target (. js/document (getElementById "test"))})

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to