Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Select or Custom entry Item from Drop-down list as Email subject

Avatar

Not applicable
Hi everyone,

from the forum I found and I use the script below on a click event to email my form:



var myDoc = event.target;

var address = "xxxx@xxx.org";

var sub = DropList1.getDisplayItem(DropList1.selectedIndex);

var msgBody = "Hello";



myDoc.mailDoc({

bUI: false,

cTo: address,

cSubject: sub,

cMsg: msgBody,

cSubmitAs: "PDF"

});



It's work fine but does not work properly when a user ENTER CUSTOM TEXT into the DropList1!

Subject line appears to be empty when we click the EmailForm button!

I know the problem it is with the SelectIndex: (DropList1.selectedIndex)but I can't think anything else..

My Drop-Down list box includes also export values.

On the subject line I want to appear ONLY the select or entry Item.

How I can solve the above?

Thanks again
4 Replies

Avatar

Level 10
Use the rawValue instead ....when you add a Custom entry you are not really selecting it. So you code would be:



var sub = DropList1.rawValue;

Avatar

Not applicable
Thanks Paul for your replay.

The problem it is when a user enter custom text the subject appears blank!



Thanks

Avatar

Level 10
Thats because of th eproperty that you are using. Change the line as I described and the var sub will contain the correct value and then the subject will get populated correctly.