Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Make button disappear when sending email

Guest
Dec 18, 2019 Dec 18, 2019

Hi there, I am making a fillable form and want to include buttons with website links as reference information for internal use. But i only want these to be seen internally, I have the buttons set so they do not print but I am looking to have it set as well that when it is sent as an email attachment the buttons don't appear. Does anyone know how to do this? Help is appreciated. Thank you!

TOPICS
PDF forms
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Dec 19, 2019 Dec 19, 2019

You need to attach the code to a submit button, as I've explained before.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

You can do that if the file is submitted from a button within it. Then you could use that button to first hide to hide those other buttons.

Another option could be to add a script to the file that checks the presence of something like a global variable and if that variable is not present it hides the buttons (or the other way around, shows them if the variable is present), and then define this variable on all of your own machines.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

So I would have to create a submit button and hide it? I don't know much about javascript. Do you have any instructions and advice? Thank you so much, this gives me hope that it is possible!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

Yes, you can use a button that executes this JavaScript code (or something like it) as its Mouse Up script:

 

this.getField("Button1").display = display.hidden;

this.getField("Button2").display = display.hidden;

this.getField("Button3").display = display.hidden;

this.getField("SubmitButton").display = display.hidden;

this.mailDoc({cTo: "target_email@server.com"});

 

Replace the field names in the first lines with the actual ones from your file, and the email address in the last line with the one you want to send the file to.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

Will the email thing work when there is multiple users in an organization  and will be using the form individually to send through their personal email address? For example: this form is available to all staff and they can click on the button for links, then click the other email button to send to their own email without the buttons showing and send out externally....And stupid question, the "button1" would just be the name you changed it to? For example: if my button is renamed 'print' I put ("print") ? I hope that makes sense 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

Yes, and yes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

So I went to my executing button for the other two I want hidden, properties, actions, mouse up, run a java script, add, typed in the script with my other two button names and the target_email@server.com and closed. They are completely gone from the pdf. I need to see those buttons while in the form. Do I have to run another actions or have anything else ticked off? 

 

I wrote the script together under the third button . Sorry for all the questions I really don't know much about javascript 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

You only need one script, under the Submit button. You don't need to apply anything to the other buttons.

You can make them visible again by going to their Properties and changing this setting there, under the General tab.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

Ahhhhhh it seems to have worked thank you thank you!! I hope you don't mind one more question. How can I lock the information I put into my fillable text boxes so when  it goes to an email attachment the person it is sent to can't edit it... if that is possible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019
You can set fields to be read-only, or flatten them if you do it in Acrobat.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

Thank you once again!! I will try setting it tomorrow. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2019 Dec 18, 2019

Hi again, can you explain how I would set up the second option of the variable you were referring to? Now that I think about it the other way a third party could possibly see the buttons is if our staff saved the file and then sent it as an email from there, it would probably show the buttons. So the ultimate goal is that if the document leaves our organization, we don't want it having buttons or links. Is that possible? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019

You can remove them entirely.

Buttons can be removed like this:

this.removeField("FieldName");

 

Links are a bit trickier. You can use this code to remove all links in the file:

for ( var p = 0; p < this.numPages; p++) {
var b = this.getPageBox("Crop", p);
this.removeLinks(p, b);
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2019 Dec 19, 2019

Where would I input the script on my file? 

 

I tried looking under file properties but I am not sure

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2019 Dec 19, 2019

Never mind I found the javascript tool lol

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2019 Dec 19, 2019

So I input the script together with the javascript tool and put it under document javascript. It just deleted my buttons for a blank page but I need to still view them until they are either emailed or saved a different name etc

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019

You need to attach the code to a submit button, as I've explained before.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2019 Dec 19, 2019
LATEST

Oh ok I thought we were adding it to the whole file to detect if the variable is present on the machine.So if someone forgets to press the submit button before saving it, it will still keep the buttons and links

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines