Customizing AEM Form Submissions for PDF/XML Formats
Hello Community Members,
I'm currently exploring the AEM form designer, and I find myself in need of some friendly advice.
Specifically, I'm curious about how to tailor the content of PDF or XML submissions when using the Submit or Email buttons. Is there a way to selectively exclude or render certain fields blank in the document sent via email? If yes, how can I do this?
Your kind insights and wisdom on this matter would be immensely appreciated.
Thank you all for being such a supportive community!
Update: Instead of using the email button, I made a regular button, and trying the below code (but nothing is happening)
function customSubmit() {
// Get the form object
var form = xfa.resolveNode("form1");
// Get the values from the form fields within Subform_1
var field1Value = form.Subform_1.TextField1.rawValue;
var field2Value = form.Subform_1.TextField2.rawValue;
// Construct the email body
var emailBody = "Field 1: " + field1Value + "\n" +
"Field 2: " + field2Value;
// Specify the email address and subject
var emailTo = 'XYZ@example.com';
var emailSubject = 'Subject';
// Use the mailDoc method to send the email
form.mailDoc({
bUI: true,
cTo: emailTo,
cSubject: emailSubject,
cMsg: emailBody,
cSubmitAs: "PDF"
});
}