perf: ⚡ Migliorata funzionalità di retrieve dei dati di un form
This commit is contained in:
parent
68f949922a
commit
d266614695
|
@ -83,7 +83,12 @@ export async function showSnackbar(
|
|||
});
|
||||
}
|
||||
export function getFormData(form: Cash) {
|
||||
return Object.fromEntries<string | File>(new FormData(form[0] as HTMLFormElement));
|
||||
const data: Record<string, any> = {};
|
||||
const inputs = form.find('text-field, material-select, text-area');
|
||||
inputs.each((index, input) => {
|
||||
data[input.id] = (input as HTMLInputElement).value;
|
||||
});
|
||||
return data;
|
||||
}
|
||||
export function isFormValid(element: Cash | HTMLFormElement): boolean {
|
||||
let form = element;
|
||||
|
|
Loading…
Reference in New Issue