mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add function to extract all data from a displayed form
This commit is contained in:
parent
5448165ef3
commit
759a3724b5
@ -564,6 +564,30 @@ function insertConfirmButton(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extract all specified form values as a single object
|
||||||
|
*/
|
||||||
|
function extractFormData(fields, options) {
|
||||||
|
|
||||||
|
var data = {};
|
||||||
|
|
||||||
|
for (var idx = 0; idx < options.field_names.length; idx++) {
|
||||||
|
|
||||||
|
var name = options.field_names[idx];
|
||||||
|
|
||||||
|
var field = fields[name] || null;
|
||||||
|
|
||||||
|
if (!field) continue;
|
||||||
|
|
||||||
|
if (field.type == 'candy') continue;
|
||||||
|
|
||||||
|
data[name] = getFormFieldValue(name, field, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Submit form data to the server.
|
* Submit form data to the server.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user