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:
@ -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,
|
||||
|
Reference in New Issue
Block a user