DOM to scope

22 views
Skip to first unread message

Andrew Gaydenko

unread,
Dec 10, 2013, 4:56:45 AM12/10/13
to som...@googlegroups.com
Hi! I have two projects in hands with plenty of (sometimes rather complicated) forms. So, I'm interested in some kind of automation of updating template.scope from <input> controls. Can soma-templates help here? What is presumed soma.js/soma-templates way for such tasks?

Romuald Quantin

unread,
Dec 10, 2013, 5:11:07 AM12/10/13
to som...@googlegroups.com
Hey Andrew,

There's some special attributes in soma-template, I didn't implement everything I wanted because of browser inconsistencies. 

You can see some form interaction at the bottom of this demo:

The rest is just normal use using tokens:
<input value="{{value}}"/>
But there's no automatic binding in soma-template in case you need those.

You can also retrieve the element using function calls if that helps:
<input value="{{getValue($element, 'something else', myVar)}}"/>
scope.getValue = function (element, p1, p2) {

Form is still a part I need to improve in the engine. Regardless if you going to use it not, what kind of actions are you going to do?

Filling inputs? Dynamically fill select boxes? What else?

Hope that helps.

Romu

Romuald Quantin

unread,
Dec 10, 2013, 5:31:13 AM12/10/13
to som...@googlegroups.com
You sent me an email but I'll answer here ;)

All events can be implemented directly, check that demo:

The thing you won't find is special implementation like what you could find for a select box for example.

Romu
Message has been deleted

Andrew Gaydenko

unread,
Dec 10, 2013, 6:01:11 AM12/10/13
to som...@googlegroups.com
That events demo doesn't work under Firefox - grey panel stays empty.

Romuald Quantin

unread,
Dec 10, 2013, 6:02:48 AM12/10/13
to som...@googlegroups.com
I might have introduced a bug with a release yesterday, I'll have a look now.


Romuald Quantin

unread,
Dec 10, 2013, 6:06:39 AM12/10/13
to som...@googlegroups.com
I provided a way to bind events without creating templates, that's what is broken, I'll repair that functionality.

The events are still working in Firefox when you use templates:

Romuald Quantin

unread,
Dec 10, 2013, 6:24:26 AM12/10/13
to som...@googlegroups.com
Just a small bug in the demo (forgot a parameter), nothing to update. It should be working now.

Andrew Gaydenko

unread,
Dec 10, 2013, 6:28:25 AM12/10/13
to som...@googlegroups.com
Yes, it does, thanks.
Reply all
Reply to author
Forward
0 new messages