How to pass form data to server action
Answered
Rhinelander posted this in #help-forum
RhinelanderOP
<form action={checkout}>
<Button className="w-full" disabled={pending}>
{pending ? "Pojdi na blagajno" : "Preusmerjam..."}
</Button>
</form>
How do I pass form data to server action. My form data is "product" - object that i get from my context.
I know how to pass each individual value but doesn't seem right (invisible input...).
How do I pass entire object to form data.
Answered by Julienng
Hi! Do you really need to pass the full object?
Is passing the ID enough? Like:
Is passing the ID enough? Like:
<input type="hidden" name="id" value={myObjectId} />
4 Replies
Hi! Do you really need to pass the full object?
Is passing the ID enough? Like:
Is passing the ID enough? Like:
<input type="hidden" name="id" value={myObjectId} />
Answer
RhinelanderOP
Yeah you are right. Than i also need to send size and quantity but apart from that id will be enough. Thank you
RhinelanderOP
Thank you