derives input values from the form
details | object| function | additional parameters (described below) |
array | returns hash of form values: data entered by user or initial data from the value property. |
function get_form() {
var values = $$('myform').getValues();
console.log(values);
}
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 behaviour:
//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());
});
To get value of some specific element within the form, you should specify its name.
webix.ui({
view:"form",
elements: [
{view:"text", id:"title", placeholder:"Enter film title"},
{...},
{view:"button", click:"get_title"}
]
})
function get_title() {
var title = $$('myform').getValues().title;
console.log(title);
}
Back to top