sets values for all inputs in the component
values | object | hash of property - value pairs |
update | boolean | if true adds updates the form with new values while exisitng values remain. **False by default** |
function set_form(){
$$('myform').setValues({
field_a: "London",
field_b: "New York"
});
};
The setValues method called only with the first parameter changes all values, regardless the values specified in the first parameter. The first parameter is an object with "key-value" pairs. Where key is a name of the form field, and value is the new value for the field.
$$('myform').setValues({
field_a: "London",
field_b: "New York"
});
If the form had fields other than the two specified in the object, their values will be reset. To avoid this and to update the specified fields only, pass the second parameter true to the setValues method.
$$('my_form').setValues({ field_b:"Paris" }, true);
// only field_b will be updated