how to hide a button on submitted form

Explorer ,
Apr 26, 2018 Apr 26, 2018

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

TOPICS
PDF forms, Windows

Views

820

Likes

Translate

Translate

Report

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

correct answers 1 Correct Answer

Most Valuable Participant , Apr 26, 2018 Apr 26, 2018
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.

Likes

Translate

Translate
Most Valuable Participant ,
Apr 26, 2018 Apr 26, 2018

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.

Likes

Translate

Translate

Report

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
Explorer ,
Apr 26, 2018 Apr 26, 2018

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?

Likes

Translate

Translate

Report

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
Most Valuable Participant ,
Apr 26, 2018 Apr 26, 2018

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.

Likes

Translate

Translate

Report

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
Explorer ,
Apr 26, 2018 Apr 26, 2018

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.

Likes

Translate

Translate

Report

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
Most Valuable Participant ,
Apr 26, 2018 Apr 26, 2018

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.

Likes

Translate

Translate

Report

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
Explorer ,
Apr 26, 2018 Apr 26, 2018

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.

Likes

Translate

Translate

Report

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
Most Valuable Participant ,
Apr 27, 2018 Apr 27, 2018

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.

Likes

Translate

Translate

Report

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
Explorer ,
May 04, 2018 May 04, 2018

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

Likes

Translate

Translate

Report

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
New Here ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

LATEST

hi

 

take a look here. this may be what you are looking for.

https://offtherichterdesign.com/Blog/acro-javascript-flatten-form-fields/

Likes

Translate

Translate

Report

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