<docuseal-form id="docusealForm" data-src="https://docuseal.co/d/LEVGR9rhZYf86M" data-email="signer@example.com"> </docuseal-form> <script> window.docusealForm.addEventListener('completed', (e) => e.detail) </script> I’d like guidance on how I can include the <script src=https://vaadin.com/forum/t/help-with-include-scripts-and-form-event-listener/"https://cdn.docuseal.co/js/form.js..." />
<docuseal-form id="docusealForm" data-src="https://docuseal.co/d/LEVGR9rhZYf86M" data-email="signer@example.com"> </docuseal-form> <script> window.docusealForm.addEventListener('completed', (e) => e.detail) </script> I’d like guidance on how I can include the <script src=https://vaadin.com/forum/t/help-with-include-scripts-and-form-event-listener/"https://cdn.docuseal.co/js/form.js..." />
I’ve tried the following, I believe I’m making mistakes in understanding the documentation. I get script error when I try the below in my vaadin view.
@JavaScript("https://cdn.docuseal.co/js/form.js")
@Route("/viewer")
@AnonymousAllowed
@PermitAll
public class SignView2 extends VerticalLayout {
public SignView2() {
// Center the content
setAlignItems(FlexComponent.Alignment.CENTER);
// Create the custom HTML element
Element docusealForm = new Element("docuseal-form");
// Set the attributes for the element
docusealForm.setAttribute("id", "docusealForm");
docusealForm.setAttribute("data-src", "https://docuseal.co/d/LEVGR9rhZYf86M");
docusealForm.setAttribute("data-email", "signer@example.com");
// Append the element to the current element
getElement().appendChild(docusealForm);
}
}