// gform_X -> X = Form ID
const gyFormId = 3;
window.addEventListener(« load », (event) => {
const gyForm = document.getElementById(« gform_ ».concat(gyFormId));
gyForm.addEventListener(« submit », concatSalesforce);
const gySubmitBtn = document.getElementById(« gform_submit_button_ ».concat(gyFormId));
gySubmitBtn.addEventListener(« click », concatSalesforce);
async function concatSalesforce(event) {
event.preventDefault();
const inputCompany = gyForm.querySelector(‘div.gy_sf_company input’);
const inputName = gyForm.querySelector(‘div.gy_sf_name input’);
const inputSurName = gyForm.querySelector(‘div.gy_sf_surname input’);
const inputEmail = gyForm.querySelector(‘div.gy_sf_email input’);
const inputDescription = gyForm.querySelector(‘div.gy_sf_description textarea’);
inputDescription.value = « BLOG FORM\nSociete : » + inputCompany.value + « \nNom : » + inputName.value + « \nPrenom : » + inputSurName.value + « \nEmail : » + inputEmail.value;
await updateDescription();
//gyForm.submit();
}
function updateDescription() {
return new Promise((resolve) => {
resolve();
});
}
});
Ce champ est masqué lorsque l‘on voit le formulaire.