[Feauture request] Data binding for form controls (one way)

It can be really useful

But we already have the solution. Check the following:

http://docs.webix.com/desktop__data_binding.html

http://docs.webix.com/samples/13_form/02_api/10_binding.html

I need data binding to javascript model, not to the another element…

Auto-saving changes from form to the external object is quite easy to add ( form has onChange event , from which you can get the updated data and push it to the source object )

If you want to have a form which reflects changes in the js object automatically, it will require some kind of observers for javascript model, which is outside of Webix UI scope.

I know abot onChange event.
But if I have really huge document to fill (200+ possible elements) there’re many code to every input element.

Data binding is standard feauture of many frameworks.

And this topic intersects with that feauture request - http://forum.webix.com/discussion/5897/feauture-request-list-elements-template-from-webix-components#latest

I’think onChange(new_val, old_val) form event has bad interface. Because it is not clear what kind of field is changed. May bee good solution is onDataInput(key, value, [old_value]).

PS Very I need this functionality, too.

Yep, the common onChange handler of form just translates the core onChange event of inside input, which may be not convenient.

Currently, you can use this.$eventSource to get the view which had emmit the original onChange event and name of the view like this.$eventSource.config.name

I’m use this code:

var obj = form.getDirtyValues(); //obj: {<field_name>: <value>}
form.setDirty(false);

form.$eventSource.config.name - that is better solution?

The solution which you are using is fine. It provides the same results as eventSource, so I don’t think that you need to change anything.