Hello, Can anyone point me in the right direction, please. I have Address Input set up on a customer quote form. It picks up the address and places it into a database and shows the address correctly. I set up a sendGrid email to inform us of the customer request. However, the address shows up in the email as Object, Object. ( Address Input is set to a Address in Field Type) Is there a way to parse it across in the email correctly to show the actual request?
Thanks
Here is the sendGrid code I am using for the email response.
$w.onReady( function () {
//TODO: write your page related code here…
let address = $w(“#addressInput1”).value;
$w(“#addressInput1”)
;
});
import {sendEmail} from ‘backend/email’;
$w.onReady( function () {
$w(“#dataset1”).onAfterSave(sendFormData);
}); function sendFormData() { const subject = New Charter Request **from** ${$w("#input10").value}; const body = `New Charter Request: ${$w(“#input10”).value}
\rFirst Name: ${$w(“#input10”).value}
I would suggest that you check Wix examples for using it with SendGrid and search this forum for previous posts about using SendGrid as your code has errors.
For starters, this bit at the top here is all happening before you have actually imported your backend email file and the page itself has loaded and is ready to go.
You are getting the error [object Object] because the $w(“#address”).value is a json object. Console log it to understand the values and use it accordingly in your email.