Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/form-data-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,21 @@ export default class FormDataJson {
isValidInput: ((input: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLElement) => boolean | undefined) | null = null,
options: FormDataJsonOptionsToJson | FormDataJsonOptionsFromJson | FormDataJsonOptionsReset | FormDataJsonOptionsClear
): any {
const el = FormDataJson.getElement(checkEl)
if (!el) {
return []
let inputs = [];
if (Array.isArray(checkEl)) {
inputs = checkEl;
}
else if (checkEl.jquery && checkEl.length>1) {
const el = null;
inputs = checkEl.toArray();
}
else {
const el = FormDataJson.getElement(checkEl);
if (!el) {
return [];
}
inputs = Array.from(el.querySelectorAll('select, textarea, input, button'));
}

let inputs = Array.from(el.querySelectorAll('select, textarea, input, button'))
// if we have a form with a name, we need to find all attributes that have a "form" attribute with that name as value as well
if (options.includeLinkedFormElements && el instanceof HTMLFormElement && el.getAttribute('id')) {
const formId = el.getAttribute('id')
Expand Down Expand Up @@ -902,4 +911,4 @@ export default class FormDataJson {
}
return c
}
}
}