How to use with a dynamic form #20
-
I have a form using react, part of the form is a button the user can use to add another set of fields (for context it's a rsvp form where the person can rsvp for another person hence the additional set of fields) the additional fields have the same name with an index added to them How can I set this up with emailjs? As it seems impractical to set up a template with loads of duplicate dynamic variables |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've managed to find what I think is a viable solution to this. As i'm controlling state in my form I have an array of objects called "People" so in my handlesubmit function I can access this and pass it into EmailJS as a field that I can access as a dynamic variable. const handleSubmit = (e: React.FormEvent) => {
|
Beta Was this translation helpful? Give feedback.
I've managed to find what I think is a viable solution to this.
As i'm controlling state in my form I have an array of objects called "People" so in my handlesubmit function I can access this and pass it into EmailJS as a field that I can access as a dynamic variable.
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();