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

hide and show buttons and text fields sending email

nawaha
Registered: Jul 30 2011
Posts: 11
Answered

i need to hide and show buttons sending an email

what i did is update the javascript in my button but what happen is that it answer to the first part of command.
i tried even to do "add a javacript" 3 times in the button but it doesn't work.

these are the lines i wrote can anyone help on this?

first time i clicked add a javascript

getField("print").display = display.noprint;
getField("send").display = display.noprint;
getField("bin").display = display.noprint;
getField("Text4").display = display.visible;

then i clicked again add a javascript

this.mailDoc({
cTo: this.getField("refer").value,
cCc: this.getField("mail").value,
cSubject: "Quotation request from: " + this.getField("company").value,
cMsg: "save this e-mail for your records"
});
then the third time
getField("print").display = display.noprint;
getField("send").display = display.noprint;
getField("bin").display = display.noprint;
getField("Text4").display = display.noView;

it gives the result to send the email and the first instruction for the button but not the last.
i know i'm doing it wrong but i'm totally new to javascript
regards Ray

My Product Information:
Acrobat Pro 10.0, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You don't need three Run a JavaScript commands. It will be better to combine them all to one.
However, it should still work... Are there any error messages in the JS console?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

nawaha
Registered: Jul 30 2011
Posts: 11
i would like to do it in just one command but i'm not able to, no i do not have any error message, it looks like it takes just the first command, then send the email but it doesn't comply the last command.
what do you think?
nawaha
Registered: Jul 30 2011
Posts: 11
Accepted Answer
{
// set the button hidden and the text visible in the mail
getField("bin").display = display.hidden;
getField("Text4").display = display.visible;
getField("send").display = display.hidden;
getField("print").display = display.hidden;
}
{
var cCCAddr = this.getField("ATTN OF").value + ", ";
var cSubLine = "Sales Quotation request, from: " + this.getField("company").value;
var cBody = "" +
"Save the mail attachment for your own records";
var cEmailURL = "mailto:sales [dot] quotation [at] mail [dot] com?cc=" + cCCAddr + this.getField("e-mail"). value
+ "&subject=" + cSubLine
+ "&body=" + cBody;
this.submitForm({cURL: cEmailURL, cSubmitAs:"PDF", cCharSet:"utf-8"});
}
{
// Set the buttons to no print and the text invisible in the mail
getField("bin").display = display.noPrint;
getField("Text4").display = display.noView;
getField("send").display = display.noPrint;
getField("print").display = display.noPrint;
}


// now it worksssssss