Hi there,
I’ve seen that a lot of people have questions about forms, submissions and notifications, but I can’t seem to find the right answer for my problem. As I’m building a website which has two seperate forms on one registration page (both with each own dataset, #1 and #2) I’m struggling with two problems.
What it should do: someone fills out form and attaches files, form input and files are stored in database (which it does btw), form input and files are send to my email address. Maybe also a confirmation to the person who fills out the form.
I’m not a coding expert and mostly follow what tutorials, youtube and websites say, but I can’t find how to code the page for two datasets at one page, as both need to be emailed to me separately when filled out. Only when you have one dataset. This code is the one I use right now and wondering how to add the second dataset coding:
import {sendEmail, sendEmailWithRecipient} from ‘backend/email’ ;
$w.onReady( function () {
$w( “#dataset1” ).onAfterSave(sendFormData);
});
function sendFormData() {
const subject = Nieuwe inschrijving bij Talent Trade: ${$w( "#input10" ).value}
;
const body = Naam: ${$w( "#input10" ).value} \rNaam: ${$w( "#input10" ).value} \rAdres: ${$w( "#input21" ).value} \rGeboortedatum: ${$w( "#datePicker1" ).value} \rTelefoon: ${$w( "#input11" ).value} \rE-mail: ${$w( "#input12" ).value} \rOpleidingsniveau: ${$w( "#input13" ).value} \rCV: ${$w( "#uploadButton1" ).value} \rID: ${$w( "#uploadButton2" ).value} \rDiploma: ${$w( "#uploadButton3" ).value} \rKvK: ${$w( "#uploadButton4" ).value} \rVOG: ${$w( "#uploadButton5" ).value} \rAansprakelijkheidsverzekering: ${$w( "#uploadButton6" ).value} \rKlachtencommissie: ${$w( "#uploadButton7" ).value}
;
const recipient = $w( “#input12” ).value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));
sendEmail(subject, body)
.then(response => console.log(response));
}
As for the second problem, up till now I couldn’t manage it to send the submission at all. I don’t know if the problem is with the file upload section as I’ve read that before, but as said above they do show up in the database.
The email.jsw and sendGrid.js are also added on my backend.
Help is appreciated!
Thanks, Nick