getValues

derives input values from the form

object getValues( [object|function details] );
detailsobject|functionadditional parameters (described below)
objecta object with form values: data entered by user or initial data from the "value" property

Example

webix.ui({
    view:"form",
    id:"myform",
    elements:[
         // name is necessary for getting the control value
         { view:"text", label:'Login', name:"login"},
         { view:"text", label:'Email', name:"email" },
         { view:"button", value:"Sumbit"}
    ]
});
 
 
function get_form() {
    var values = $$("myform").getValues();
    //returns { login:"", email:""}
}

Related samples

Details

Please note that controls must have the name property specified to get their values.

Additonal parameters

When the method is called without the arguments, all the values of this form are returned including the values of hidden and disabled fields.

Still, you can alter this behavior:

//returns values of visible fields only
$$('myform').getValues({hidden:false});
 
//returns values of enabled fields only
$$('myform').getValues({disabled:false});
 
//excludes both hidden and disabled fields from the result
$$('myform').getValues({
    hidden:false, 
    disabled:false
});

Additionally, you can pass a loop function into the method to iterate through the form controls:

$$('myform').getValues(function(obj){
    //'obj' points to a control object
    console.log(obj.getValue());
});

Getting the value of a specific element

To get the value of some specific element within the form, you should specify its name.

webix.ui({
    view:"form",
    elements: [
        {view:"text", name:"title", placeholder:"Enter film title"},
        {view:"button", click:get_title}
    ]
})
 
function get_title() {
    var title = $$('myform').getValues().title;
    console.log(title);
}
See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix js frameworks and page of form elements product.