yarn add conventional-form
To have access to form values without input control you must use the name propertie of each input. If you have any value wich is not a real input value you must add an hidden input with the name you want.
Your form value will be an object with keys as each input names in your form. You can define nested object and array with '-' in your name like this :
// List of your inputs names
'name.lastname';
'name.firstname';
'age';
'contacts.0.userId';
'contacts.0.text';
'contacts.1.userId';
'contacts.1.text';
// Your data will be like this
type Data = {
name: { lastname: string; firstname: string };
age: string;
contacts: [{ userId: string; text: string }, { userId: string; text: string }];
};
import { getRequestSearchData, getRequestFormData } from 'conventional-form';
const data = getRequestSearchData(formData);
// or
const data = getRequestFormData(searchParams);