Copy link to clipboard
Copied
Hi Everyone
New and learning Adobe User here.
I'm trying to find a way to hide the submitted button on a form that is submitted via email so it does not show up on the submitted copy.
I have tried the show\hide action for the button but it does not seem to work in this case so I'm thinking that it will take a Java based command but I don't know enough about it and if someone could please provide some script that would work in this case.
Thanks
Yes. You will have to do everything in a single "Run a JavaScript" command, or you won't be able to control the order in which the commands are executed.
Copy link to clipboard
Copied
You can do it like this:
event.target.display = display.hidden;
this.submitForm({cURL: "mailto:me@server.com", cSubmitAs: "PDF"});
Note that you should remove all other commands associated with the button if you use this script.
Copy link to clipboard
Copied
Hi Try67
Now is this a command that is run under the Actions menu JavaScript or is this embedded into the document JavaScript menu?
Copy link to clipboard
Copied
Assuming you have a Submit button in your file, you should use it as that button's Mouse Up action.
Copy link to clipboard
Copied
Hi try67
I noticed that the script has a mail command in it, will I have to remove the Submit Form action from the actions menu or can I leave it in and remove the command out of the script?
I also have another JavaScript to flatten the document before sending.
Thanks ahead of time and you have been a big help.
Copy link to clipboard
Copied
Yes. You will have to do everything in a single "Run a JavaScript" command, or you won't be able to control the order in which the commands are executed.
Copy link to clipboard
Copied
Hi Try67
Thanks for the response
Ok I combined the JavaScript and tested it but it did not seem to work, When I click on the submit button it does not create and email and attach the document now, am I just putting the script in the wrong spot or does something have to change with FlattenFields function?
please see below
flattenFields()
function flattenFields() {
if (app.viewerType=="Reader") {
for (var i=0 ; i<this.numFields ; i++) {
var f = this.getField(this.getNthFieldName(i)) ;
if (f==null) continue;
f.readonly = true;
}
} else {
this.flattenPages();
}
}
event.target.display = display.hidden;
this.submitForm({cURL: "mailto:me@server.com", cSubmitAs: "PDF"});
Thanks again.
Copy link to clipboard
Copied
You can't hide a button that doesn't exist (because it was flattened)... You need to first hide it, and then flatten the file.
Copy link to clipboard
Copied
Hi Try67
I just want to follow up with you as I'm still struggling with the scripting.
I have been doing some field testing and we are still having some issues.
the script is setup to hide the Submit button then attach it to an email but what we are running into is that it attaches the document as blank even though the scrip flattens the document after the email attachment.
please see below script format and let me know what is wrong.
event.target.display = display.hidden;
this.submitForm({cURL: "mailto:email@address.com", cSubmitAs: "PDF"});
flattenFields()
function flattenFields() {
if (app.viewerType=="Reader") {
for (var i=0 ; i<this.numFields ; i++) {
var f = this.getField(this.getNthFieldName(i)) ;
if (f==null) continue;
f.readonly = true;
}
} else {
this.flattenPages();
}
}
Thanks
Copy link to clipboard
Copied
hi
take a look here. this may be what you are looking for.
https://offtherichterdesign.com/Blog/acro-javascript-flatten-form-fields/