# Send multiple form submission email in same page | URGENT 

**URL:** <https://forum.wixstudio.com/t/send-multiple-form-submission-email-in-same-page-urgent/24507>\
**Category:** Ask the community\
**Tags:** wix-forms, question, code\
**Created:** [December 1, 2020, 2:10pm UTC](https://forum.wixstudio.com/t/send-multiple-form-submission-email-in-same-page-urgent/24507 "2020-12-01T14:10:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![graduationprojectmis](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/graduationprojectmis/32/21147_2.png) [@graduationprojectmis](https://forum.wixstudio.com/u/graduationprojectmis)\
**Post date:** [December 1, 2020, 2:10pm UTC](https://forum.wixstudio.com/t/send-multiple-form-submission-email-in-same-page-urgent/24507/1 "2020-12-01T14:10:00Z")

</div>

Hello Wix,

My problem is that I have two forms in the same page and I want to send one email for each form if it’s filled, I wrote a code and it works well (it sends an email with the submitted data ), but I’m facing a small issue which is receiving two emails (one of them is full and the other is empty for the second form that is not filled)

How to edit the code to send only one email for the filled form.

 ![](https://us1.discourse-cdn.com/wix/original/3X/b/e/be845ae84bbe4d95a755aba59e6ca978d36f6e9f.jpeg)

---

<div class="post-metadata">

**Author:** ![graduationprojectmis](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/graduationprojectmis/32/21147_2.png) [@graduationprojectmis](https://forum.wixstudio.com/u/graduationprojectmis)\
**Post date:** [December 1, 2020, 2:38pm UTC](https://forum.wixstudio.com/t/send-multiple-form-submission-email-in-same-page-urgent/24507/2 "2020-12-01T14:38:04Z")

</div>

**import** {sendEmail,sendEmailWithRecipient} **from** ‘backend/email’ ;

$w.onReady( **function** () {  
$w( “#dataset2” ).onAfterSave(sendFormData);  
$w( “#dataset3” ).onAfterSave(sendFormData);  
});

**function** sendFormData(){  
{ **const** subject = `Submission sucssful ${$w( "#FirstName" ).value}`;  
**const** body =  
`New client: ${$w( "#FirstName" ).value} \rFirst name: ${$w( "#FirstName" ).value} \rLast name: ${$w( "#LastName" ).value} \rEmail: ${$w( "#Cemial" ).value} \rPhone number: ${$w( "#PhoneNumber" ).value} \rCategory: ${$w( "#Category" ).value} \rNumber of photos/videos: ${$w( "#Quantity" ).value} \rVideo Length: ${$w( "#VideoLength" ).value} \rDate: ${$w( "#Date" ).value} \rLocation: ${$w( "#Location" ).value} \rRefrence: ${$w( "#UrlReference" ).value} \rImage refrence: ${$w( "#upload" ).value} \rDescription: ${$w( "#Description" ).value}`;  
**const** recipient = $w( “#PhoneNumber” ).value;

sendEmailWithRecipient(subject, body, recipient)  
.then(response =\> console.log(response));

sendEmail(subject, body)  
.then(response =\> console.log(response));  
}  
{ **const** subject = `Submission sucssful (previuos client) `;  
**const** body =  
`\rEmail: ${$w( "#email2" ).value} \rCategory: ${$w( "#Category2" ).value} \rNumber of photos/videos: ${$w( "#Quantitiy2" ).value} \rVideo Length: ${$w( "#vlength2" ).value} \rDate: ${$w( "#sDate2" ).value} \rLocation: ${$w( "#sLocation2" ).value} \rRefrence: ${$w( "#URLref2" ).value} \rImage refrence: ${$w( "#imageRef2" ).value} \rDescription: ${$w( "#description2" ).value}`;  
**const** recipient = $w( “#email2” ).value;

sendEmailWithRecipient(subject, body, recipient)  
.then(response =\> console.log(response));

sendEmail(subject, body)  
.then(response =\> console.log(response));  
}

}
