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
Giant panda
Use a
type="hidden" field for it.Answer
Giant panda
And, of course, validate it server-side accordingly.
@Giant panda Use a `type="hidden"` field for it.
ChartreuxOP
ahhh, this doesn't cross my mind
@Giant panda And, of course, validate it server-side accordingly.
ChartreuxOP
alright, thank you