Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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

Avatar

Former Community Member
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

Former Community Member
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

Former Community Member
Thanks Paul for your replay.

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



Thanks

Avatar

Former Community Member
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.