Why is the selected value not showing up in formData?
Answered
West African Lion posted this in #help-forum
West African LionOP
I have a form with two text inputs and one select input. The text inputs show up in the form data after submission, but the
select isn't, and I'm unsure why...<form className="w-44 text-center mx-auto flex gap-4 flex-col">
<Input type="text" name="name" placeholder="Your Name" required />
{data?.condition === "something" && (
<>
<Input type="text" name="email" placeholder="Your Email" required />
<div className="max-w-md">
<div className="mb-2 block">
<Label htmlFor="question" value="Select Your Answer" />
</div>
<select id="question" required>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
</>
)}
<SubmitButton pendingText="Signing In..." formAction={AnonSignInAction}>
Continue Without User
</SubmitButton>
</form>Answered by West African Lion
I'm an idiot...
I was missing the name attribute. Once I added that, it worked as expected
I was missing the name attribute. Once I added that, it worked as expected
<select name="question" id="question" required>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>1 Reply
West African LionOP
I'm an idiot...
I was missing the name attribute. Once I added that, it worked as expected
I was missing the name attribute. Once I added that, it worked as expected
<select name="question" id="question" required>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>Answer