2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 19:20:55 +00:00

javascript for editing settings via API

This commit is contained in:
Oliver
2021-11-09 21:16:37 +11:00
parent 324335a620
commit 5df4374607
3 changed files with 78 additions and 14 deletions

View File

@ -198,14 +198,6 @@ function constructChangeForm(fields, options) {
json: 'application/json',
},
success: function(data) {
// Push existing 'value' to each field
for (const field in data) {
if (field in fields) {
fields[field].value = data[field];
}
}
// An optional function can be provided to process the returned results,
// before they are rendered to the form
@ -218,6 +210,14 @@ function constructChangeForm(fields, options) {
}
}
// Push existing 'value' to each field
for (const field in data) {
if (field in fields) {
fields[field].value = data[field];
}
}
// Store the entire data object
options.instance = data;
@ -724,6 +724,11 @@ function submitFormData(fields, options) {
data = form_data;
}
// Optionally pre-process the data before uploading to the server
if (options.processBeforeUpload) {
data = options.processBeforeUpload(data);
}
// Submit data
upload_func(
options.url,