Hi!
I made a form with Corvid which contains two types of data: https://www.bhenv.fr/demande-isolation
The clicked ones, for example if the visitor clicks on “Yes” I would like the email contains this data;
The input ones : name, first name, postcode and phone.
So far, I’m having an issue because I cannot find how to integrate the clicked data (= text on button so “Yes” in that case) into the body of the email sent after submission.
Here is my code:
import wixCRM from ‘wix-crm’;
import wixLocation from ‘wix-location’;
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
import {sendEmail} from ‘backend/email’;
let userId = wixUsers.currentUser.id;
$w.onReady(() => {
let toSave = {_id: userId};
$w(“#button3, #button4”).onClick(event => {
switch (event.target.id){
case “button3”:
toSave.maisonIndividuelle = “oui”;
$w(‘#group4’).hide();
$w(‘#group9’).show();
break ;
}
})
$w.onReady( function () {
$w(“#dataset1”).onAfterSave(sendFormData);
});
function sendFormData() {
const subject = Nouveau lead : ${$w("#input1").value}
;
const body = Informations du lead : Nom : ${$w("#input1").value} Prénom : ${$w("#input2").value} Code postal : ${$w("#input5").value} Téléphone : ${$w("#input6").value}
;
sendEmail(subject, body)
.then(response => console.log(response));
}
})
Thanks for your help.