These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

EMAIL/Drop-down list question

patra
Registered: Oct 19 2006
Posts: 270
Answered

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 [at] xxx [dot] 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!
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

My Product Information:
LiveCycle Designer, Windows
cyanstudios
Registered: May 6 2008
Posts: 81
The problem looks like it lies in "(DropList1.selectedIndex);"
So if they select something from the index, you're fine, but once something custom is entered, it's really no longer a selected index.

I've never done this, but would DropList1.rawValue need to be referenced if it was entered custom? If so, then you would need to somehow have the form able to grab one or the other. You could try experimenting with if statements or try concatenating the rawValue with selectedIndex, so that it always reports really only one, but always something.

Looks good on paper.
patra
Registered: Oct 19 2006
Posts: 270
(DropList1.selectedIndex) - SelectIndex I believe is the problem too.

Maybe if we use "xfa.event.newText" but I do not know how!

I am out of ideas.

Thanks
cyanstudios
Registered: May 6 2008
Posts: 81
Got it. I just made a small example to test something.

Make a text field that will eventually be hidden. On your drop down, go to the change event and make sure it's javascript.
texfield.rawValue = xfa.event.newText

Now change
var sub = DropList1.getDisplayItem(DropList1.selectedIndex);
to say
var sub = textfield.rawValue;

Test it, if it works, go hide that text field and you should be aces.
patra
Registered: Oct 19 2006
Posts: 270
THANKS