group return of form action
Unanswered
Cinnamon Hummingbird posted this in #help-forum
Cinnamon HummingbirdOP
suppose i have a from like that
what would need to be done to get a return like that as the formData input of the action
the only solution i came up with is to concatenate the name such that
<form action={handleForm}>
{someArr.map((el) => )
<input type="text" hidden={true} name="id" defaultValue={el.id} />
<select name="vote">
<option value="yay">YAY</option>
<option value="naa">NAA</option>
</select>
}
<button type="submit">Save</button>
</form>what would need to be done to get a return like that as the formData input of the action
[
{name: "id", value: "abc123"},
{name: "vote", value: "yay"}
],
[
{name: "id", value: "abc456"},
{name: "vote", value: "naaa"}
],
...the only solution i came up with is to concatenate the name such that
{name: "vote__abc123", value: "yay"}, ... and then deal with it in the action but that seems hacky.