Getting form values
As shown in the Basic Usage Section, <inform-el />
submit
event gives the form values:
<inform-el>
<form>
<label>
First Name
<input type="text" name="firstName" />
</label>
<label>
Last Name
<input type="text" name="lastName" />
</label>
<button type="submit">Submit</button>
</form>
</inform-el>
<script>
document.querySelector("inform-el").addEventListener("submit", ({ detail: { values } }) => {
console.log("Submitted:", values); // {firstName: '', lastName: ''}
});
</script>
<inform-el />
also exposes a values
property:
document.querySelector("inform-el").values; // {firstName: '', lastName: ''}