Commit bb70c4bd authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_web_renderjs_ui: add default_${key}:int:0 to some fields

- CheckBoxField
- ListField
- MultiCheckBoxField
- MultiListField
- RadioField
parent 8a980df8
......@@ -56,6 +56,13 @@
return this.getDeclaredGadget('sub')
.push(function (gadget) {
return gadget.getContent();
})
.push(function (result) {
var key_list = Object.keys(result), i;
for (i = 0; i < key_list.length; i += 1) {
result["default_" + key_list[i] + ":int"] = 0;
}
return result;
});
}
return {};
......
......@@ -84,6 +84,13 @@
return this.getDeclaredGadget('sub')
.push(function (gadget) {
return gadget.getContent();
})
.push(function (result) {
var key_list = Object.keys(result), i;
for (i = 0; i < key_list.length; i += 1) {
result["default_" + key_list[i] + ":int"] = 0;
}
return result;
});
}
return {};
......
......@@ -38,6 +38,7 @@
required: field_json.required,
name: field_json.key,
title: field_json.title,
key: field_json.key,
sub_select_key: field_json.sub_select_key,
sub_input_key: field_json.sub_input_key,
hidden: field_json.hidden
......@@ -111,6 +112,11 @@
}
return queue
.push(function () {
if (result_list[result_list.length - 1] === "") {
result_list.pop();
}
final_result[gadget.state.key] = result_list;
final_result["default_" + gadget.state.key + ":int"] = 0;
final_result[gadget.state.sub_select_key] = result_list;
final_result[gadget.state.sub_input_key] = 0;
return final_result;
......
......@@ -148,6 +148,7 @@
var j;
for (j = 0; j < result_list.length; j += 1) {
if (result_list[j].hasOwnProperty(gadget.state.name)) {
result_list[j]["default_" + gadget.state.name + ":int"] = 0;
return result_list[j];
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment