Email from form submission

So I have this form, and I followed this tutorial about sending an email from form submission and all worked ok. But I want to make that the email being sent will have the user’s email from the “Your email” input box in order to reply strait to it when the email arrives. I tried putting in const sender = $w(“#email”).value in the eamil.jsw backend but it will not return that value! (the Your email line is connected to #email and works ok with the cms collection)

Thanks!

Hi Matan,

What is the error message you get?
(Hover the red point to see the message)

Best,
Sapir

#email ’ is not a valid selector

Hi,

Continue to read the article, the part of Modifying the Code , you will get en explanation on how to get the email user to the backend function as parameter.

*The backend email.jsw supposed to include the second function in the picture below when you get the recipient as parameter.
Pay attention, that the backend function can’t reach to the element in the site page.


Afterword, write the Front end function according to the picture below.


Best,
Sapir

No, what you wrote is wrong. I finally solved it, I added const sender = $w(“#email”).value to the frontend and added “sender” to the sendEmail. With that, in the email.jsw I removed the const sender and added sender to the export function sendEmail()
Now everything works!

Hi Matan,

As you can see, the screen shot that I sent you in the second post its exactly the same as you wrote in the fixed code.

Happy its works for you,
Best,
Sapir

I’m sorry Sapir, but you’re wrong…I switched the recipient and the sender and added the sender in the export function sendEmail