onChange

fires when data in the input of related form/toolbar is changed

void onChange(any newValue,any oldValue, [any config] );
newValueanynewly set value
oldValueanyprevious value
configanysource of change

Example

$$("form1").elements["login"].attachEvent("onChange", function(newv, oldv, config){
    //"login" is name of related form field
    webix.message("Value changed from: "+oldv+" to: "+newv);
});    
//or
$$("form1").attachEvent("onChange", function(newv, oldv, config){
    webix.message("Value changed from: "+oldv+" to: "+newv);
});

Related samples

Details

The config parameter can have the following values:

  • "user" - if the change was made by user
  • "auto" - if the change was made by the library inner logic
  • undefined - if the change was made by a control's setValues method call made by a programmer.

Also, you can get a custom value as the config parameter. To do that call the setValues method passing your value as the last argument:

webix.ui({
  view:"form",
  // ..config
  on:{
    onChange: function(newValue, oldValue, config){
        // config is {yourProperty: "yourValue"}
    }
  }
});
 
// onChange event will receive object as the last parameter
$$("$form1").setValues(values, true, {yourProperty: "yourValue"});
See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix ui library and page of javascript form product.