Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Email button with code not working

Avatar

Level 5

I have a form that has an email with code that prompts an error when a required field is not populated.  A request came through from the owner asking for creation of a drop down field (Invoice Type) that has 3 choices.  Based on which choice is selected, certain fields appear and are required.  They can't be set as required up front because they aren't always shown.  Anyway, I've set the fields so they appear when they should and the fields are noted as required but now the email button does not work. Could there be conflicting logic between the email button and the code in the Invoice Type? I don't think the new fields can be coded into the email button but I really don't know.  This is way beyond my knowledge or comprehension.  I appreciate any guidance. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

In your email button script, correct the below line:

in the below code, check you're if statement code:

if (form1.Page1.ddInvoiceType.rawValue== null)
{
xfa.host.setFocus(form1.Page1.ddInvoiceType.rawValue);
form1.Page1.ddInvoiceType.border.edge.color.value = "230,0,0";
}

 

Check the somExpression in below code:

I have corrected this:

cSubject: "INV: " + Page1.subAgencyAddress.LocalPublicAgency.rawValue + " " + Page1.subNumbersDate.StateJobNo.rawValue,

 

Fix these two points, your email functionality will work.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

In your email button script, correct the below line:

in the below code, check you're if statement code:

if (form1.Page1.ddInvoiceType.rawValue== null)
{
xfa.host.setFocus(form1.Page1.ddInvoiceType.rawValue);
form1.Page1.ddInvoiceType.border.edge.color.value = "230,0,0";
}

 

Check the somExpression in below code:

I have corrected this:

cSubject: "INV: " + Page1.subAgencyAddress.LocalPublicAgency.rawValue + " " + Page1.subNumbersDate.StateJobNo.rawValue,

 

Fix these two points, your email functionality will work.