• Takes in a form element or submit event and returns a mapping between the input's name and their values

    If using a SubmitEvent, the name and value of the HTMLButtonElement used to submit the form will be included.

    Parameters

    • source: HTMLFormElement | SubmitEvent

      HTMLFormElement or SubmitEvent to get the values from

    Returns {
        [inputName: string]: string | number | boolean | Date | FileList | null | undefined;
    }

    a mapping between the input's name and their values. The type of value is determined as so:

    • <input type="checkbox">: boolean or null if indeterminate
    • <input type="datetime-local">: Date or null if none is entered
    • <input type="file">: FileList
    • <input type="number">: number
    • <input type="range">: number
    • <input type="radio">: string - The value of the selected radio button. If none are selected, this will be an empty string. This reflects the behaviour of RadioNodeList.
    • All other inputs: string
    • [inputName: string]: string | number | boolean | Date | FileList | null | undefined