I have an Om dom/select component with several dom/option subcomponents.
I want to use a function as the :value of the dom/option components which 
dom/select will receive on change and do something with it. However it seems 
that react turns the value into a string. I tried using cljs.reader/read-string 
which didn't work:

(dom/select #js {:onChange #(let [f (cljs.reader/read-string (.. % -target 
-value))]
                             (om/set-state! owner :my-function f))}
            (dom/option #js {:value (my-function arg1 arg2)} "set-my-function"))

(type (fn my-fn [arg1 arg2] (print arg1 arg2)))
;; => function Function() { [native code] }

(type (.. % -target -value))
;; => function String() { [native code] }

(type (cljs.reader/read-string (.. % -target -value)))
;; => function (ns,name,str,_hash,_meta){
this.ns = ns;
this.name = name;
this.str = str;
this._hash = _hash;
this._meta = _meta;
this.cljs$lang$protocol_mask$partition0$ = 2154168321;
this.cljs$lang$protocol_mask$partition1$ = 4096;
}

What can be done?

-- 
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