How to add a field or variable to formdata?
Answered
Chartreux posted this in #help-forum
ChartreuxOP
I have a form that can be used to add or update data using RHF and useActionState. I need to pass a variable so the server action can differentiate the type action. So, my question is how to add a variable to formData or is there better way to do this?
4 Replies
Asian black bear
Use a
type="hidden"
field for it.Answer
Asian black bear
And, of course, validate it server-side accordingly.
@Asian black bear Use a `type="hidden"` field for it.
ChartreuxOP
ahhh, this doesn't cross my mind
@Asian black bear And, of course, validate it server-side accordingly.
ChartreuxOP
alright, thank you