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

Email question

PITTfan2
Registered: Sep 5 2009
Posts: 14

I have put a javascript code on a button to email a form. The script is as follows:

var oDoc = event.target;
oDoc.mailDoc({
bUI: false,
cTo: "pnf [at] jeffersonregional [dot] com" ,
cBcc: "renee [dot] holtzman [at] jeffersonregional [dot] com; janice [dot] lenz [at] jeffersonregional [dot] com" ,
cSubject: " " + LastName.rawValue + ", " + FirstName.rawValue + " : Reason - " + ReasonforChg.rawValue + " "
})

How can I modify the script so that when the user clicks it an email is sent without launching an email window?

Also, how can I add validation script before the email is sent to tell the user that required information is missing and how and where would I add this script?

My Product Information:
LiveCycle Designer, Windows
dk3dknight
Registered: Jan 22 2008
Posts: 136
Hmm well lets see not very familiar with javascript so ill try to help you with the other half.

There are several ways to do a validation script but first tell me are you wishing to check if there empty or if they have entered something dumb into the field?

While its possible to create a presubmit instead im going to walk you through doing a validation of empty fields on your click event and work your print script into it.

Edit
Sample
https://share.acrobat.com/adc/document.do?docid=534e39e6-d209-4dc9-ba38-7c5fde0e52ec

I dont know what I was thinking.
willin2u
Registered: Sep 14 2009
Posts: 16
I would like to check when the required fields are empty.
dk3dknight
Registered: Jan 22 2008
Posts: 136
That would check to see if there empty
if they == "" which represents nothing.

If they equal nothing the requirement
to email is not met, but if they = something
other then nothing they have met the requirement
to email and thus the email script is launched.

Again I used form calc in my sample so your going
to have to write it for javascript.

Cheers

Update == doesn't work in formcalc in if statements use

if (TextField1==Null) then
xfa.host.messageBox("boo",0,1)
//elseif
else
xfa.host.print(1, "0", "0", 0, 1, 0, 0, 0)
endif
willin2u
Registered: Sep 14 2009
Posts: 16
I think I am missing something. What is the hiddenTextField? Do I need to put this script in a textfield?
dk3dknight
Registered: Jan 22 2008
Posts: 136
willin2u wrote:
I think I am missing something. What is the hiddenTextField? Do I need to put this script in a textfield?
Create a TextField called hiddenTextField and give it the properties of invisible

Put the script I showed you on your print button under a click event.

Im sorry I should have been more thorough with my answer im sorry..

If you need me to ill go more into what the script does and why it works, ill gladly go into more detail, I do have this post subscribed so ill be watching.
willin2u
Registered: Sep 14 2009
Posts: 16
I'm afraid I'm going to need a little more to go on, especially when you talk about a print button. Thanks!
dk3dknight
Registered: Jan 22 2008
Posts: 136
Okay I just figured out your not the person who created the first post so my references to his post are invalid.

Since you dont have that requirement for javascript ill make you a sample to look at for use in Form calc ill be done shortly I promise.
dk3dknight
Registered: Jan 22 2008
Posts: 136
if (TextField1==Null) then
xfa.host.messageBox("boo",0,1)
elseif (TextField2==Null) then
xfa.host.messageBox("boo1",0,1)
elseif (TextField3==Null) then
xfa.host.messageBox("boo2",0,1)
else
xfa.host.print(1, "0", "0", 0, 1, 0, 0, 0)
endif

Sample: https://share.acrobat.com/adc/document.do?docid=534e39e6-d209-4dc9-ba38-7c5fde0e52ec

Sorry about that.
willin2u
Registered: Sep 14 2009
Posts: 16
Well, that didn't work and I can't get the sample link to open.
dk3dknight
Registered: Jan 22 2008
Posts: 136
Okay well I went ahead and hosted it somewhere else as well.

http://docs.google.com/fileview?id=0B-drzn5llddGY2RlY2NiYjUtMzNhZi00ZmY2LWFjMDQtOTMwOWZmNWIxZDUz&hl=enI would have assumed adobe's sharing site would have worked hopefully google is
fall back to.

If you want I can email it to you, my email is dk3dknight at gmail dot com
willin2u
Registered: Sep 14 2009
Posts: 16
Is it possible to get this:

cTo: "pnf [at] jeffersonregional [dot] com" ,
cBcc: "renee [dot] holtzman [at] jeffersonregional [dot] com; janice [dot] lenz [at] jeffersonregional [dot] com" ,
cSubject: " " + LastName.rawValue + ", " + FirstName.rawValue + " : Reason - " + ReasonforChg.rawValue + " "

in the Submit to URL. I would like to keep the reference to fields in it.
dk3dknight
Registered: Jan 22 2008
Posts: 136
willin2u wrote:
Is it possible to get this:cTo: "pnf [at] jeffersonregional [dot] com" ,
cBcc: "renee [dot] holtzman [at] jeffersonregional [dot] com; janice [dot] lenz [at] jeffersonregional [dot] com" ,
cSubject: " " + LastName.rawValue + ", " + FirstName.rawValue + " : Reason - " + ReasonforChg.rawValue + " "

in the Submit to URL. I would like to keep the reference to fields in it.
mailto:astark1 [at] unl [dot] edu?subject=MailTo Comments&cc=ASTARK1 [at] UNL [dot] EDU&bcc=id [at] internet [dot] node"Thats how you do Carbon Copys and Blind Copys, but raw value's are javascript and im not exactly familiar with javascript.