> As of right now all the selectors are done at compile time so dynamic 
> selectors are not possible.

Ah, that explains that then.

>  That being said I think there are several ways to accomplish what you are 
> trying to do.    Is there a reason you are calling om/build here instead of 
> just calling do-input-field.

I'll be honest, being very new to om and kioo I'm basing all my work on 
examples I can find, which are the those in the source code (only snippets and 
templates, which I equally struggled to understand how to update state in for 
text fields), and the todo-mvc app. The (om/build) was used in 
https://github.com/ckirkendall/todomvc/blob/gh-pages/labs/architecture-examples/kioo/src/todomvc/app.cljs#L161
 so I've been playing around with similar forms to get my own code working.

>  I am trying to understand what the sub component is used for.  Below is 
> another approach that is a bit more declarative.  

Thanks for this. I'm just trying this out to see how far it gets me.

On the subject of templates though, why doesn't something as simple as this 
work to track changes to input fields?

(defn handle-change [e data edit-key]
  (println "handle-change:" edit-key @data)
  (om/transact! data edit-key (fn [_] (.. e -target -value))))

(deftemplate form-contact "public/fragments/f1.html"
  [data]
  {[:input#name] (do->
                  (set-attr :value (:name data))
                  (listen :on-change #(handle-change % data :name)))})

I only see changes for the previous value in the console output when I press a 
key (I'm guessing this is app-value vs state of component issue, but I can't 
see how to get access to the state object like in a normal om/IRenderState 
section), and the first input of any text immediately deselects the input.

many thanks for the feedback.

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