Hello Wix Team!
Trying to set field values and then send email on submission. The field values get set to database but email won’t send through. If I remove the set field values in red the form submits. When I add them the fields update but form does not submit.
Here’s my code: Anyone could tell me what I’m missing here?
I appreciate your time.
export function button47_click(event) {
$w(“#dynamicDataset”).onReady( () => {
$w(‘#dynamicDataset’).setFieldValue(‘confirmed’, $w(‘#text384’).text);
$w(‘#dynamicDataset’).save();
$w(‘#text85’).show();
$w( ‘#dynamicDataset’ ).onReady(sendFormData);
function sendFormData() {
const subject = Vehicle Service Confirmed For ${$w( "#input7" ).value}
;
const body = `Dear ${$w( “#text306” ).text},
Your booking is confirmed!
Thank you **for** choosing our garage.
Your appointment details are as follows:
Scheduled Date:
${$w( "#text293" ).text}+${$w( "#input14" ).value}
Scheduled Time:
${$w( "#input1" ).value}
Get directions on the link below. See you soon!
Kind Regards,
Location:
${$w( "#garagestreetaddress" ).text}
${$w( "#garagecityprovince" ).text}
${$w( "#garagepostalcode" ).text}
`; const recipient = $w( "#input2" ).value; sendEmailWithRecipient(subject, body, recipient) .then(response => console.log(response));sendEmail(subject, body)
.then(response => console.log(response));
}
})
}