This is my repeat question because I think my post goes away from your sights.
Here is my Code for SUBMISSION FORM, I want the visitor to fill this form and upload his image, After this, I receive an Email including an Image link from the Wix server.
My code:
import {sendEmail} from 'backend/email';
$w.onReady(function () {
$w("#dataset1").onAfterSave(sendFormData);
});
function sendFormData() {
const convertRegex = new RegExp(/wix:document:\/\/v1\/([^\/]+)\/(.*)$/);
const item = $w('#dataset1').getCurrentItem();
//Instead of "fieldName", add here the relevant field name to which
//the upload button is connected to.
let documentUrl;
if ($w("#uploadButton1").value.length > 0) {
const matchesupload = item.upload.match(convertRegex);
documentUrl = `docs.wixstatic.com/ugd/${matchesupload[1]}?dn=${matchesupload[2]}`;
}
const subject = `from New Client Request from Website ${$w("#input1").value}`;
const body = `Name: ${$w("#input1").value}
\rMobile: ${$w("#input4").value}
\rE-mail: ${$w("#input5").value}
\rComments: ${$w("#textBox1").value}
\rPersonalDetails: ${$w("#radioGroup2").value}
\rPropertyDetails: ${$w("#radioGroup1").value}
\rPropertyType: ${$w("#dropdown1").value}
\rPropertyType: ${$w("#dropdown2").value}
\rCity: ${$w("#input3").value}
\rLocation: ${$w("#input2").value}
\rFile: ${documentUrl}`;
sendEmail(subject, body)
.then(response => console.log(response));
}
My Result, If you see in the File I want an image link but I receive UNDEFINED, Please share some tips so I correct this error, Thank You.
Name: SUNEEL
Mobile: 0123456789
E-mail: SK@GMAIL.COM
Comments: HELLO
PersonalDetails: Agent
PropertyDetails: Rent/ Lease
PropertyType: Commercial Office Space
PropertyType: Agricultural Land
City: ND
Location: UN
File: undefined (I want doucment link here so client download the file.)