submit button JavaScript

Explorer ,
Aug 07, 2019

Copy link to clipboard

Copied

hi, i have found bellow code & edited but it's not working. can u pls help me to correct submit button JavaScript. i'm using adobe pro DC. thanks..

var myDoc = event.target;

try {

    myDoc.mailDoc({

        bUI: false,

        cTo: 'sbartholow@ppbi.com',

        cCc: 'khall@ppbi.com',

        cSubject: 'New Employee Form - '+EmpName+ " - " + StrtDate+ " - " + Loc,

        cSubmitAs: "PDF",

        cMsg: cBody

    });

} catch (e) {

 

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

88

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

submit button JavaScript

Explorer ,
Aug 07, 2019

Copy link to clipboard

Copied

hi, i have found bellow code & edited but it's not working. can u pls help me to correct submit button JavaScript. i'm using adobe pro DC. thanks..

var myDoc = event.target;

try {

    myDoc.mailDoc({

        bUI: false,

        cTo: 'sbartholow@ppbi.com',

        cCc: 'khall@ppbi.com',

        cSubject: 'New Employee Form - '+EmpName+ " - " + StrtDate+ " - " + Loc,

        cSubmitAs: "PDF",

        cMsg: cBody

    });

} catch (e) {

 

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

89

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
Aug 07, 2019 0
Most Valuable Participant ,
Aug 07, 2019

Copy link to clipboard

Copied

"Not working" how, exactly?
And why did you add a try-catch clause and then not even print out the contents of the caught error? You've made it almost impossible to know what went wrong with your code.

Remove that and try again.

Oh, and also remove the bUI parameter. It won't work. The UI will be displayed and the user will have to manually send the email.

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
Reply
Loading...
Aug 07, 2019 0
Explorer ,
Aug 07, 2019

Copy link to clipboard

Copied

hi, i'm really sorry i have done wrong. actually bellow code add to submit button in livecycle form. so i want to add same code into my form but i'm making my form using adobe pro DC. can u pls help me to convert bellow submit code that work in adobe pro ??. thanks..

form1.Page1.E-mailButton::click - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:F0343AD4-256A-4447-B553-B26FB0EBFD0B CRC:2547463463)

//+ Type: Action

//+ Result4: SetEnabled("$Node4","readOnly")

//+ Result3: SetPresence("$Node3","hidden")

//+ Result2: SetPresence("$Node2","visible")

//+ Result1: SetFieldValue("$Node2","tovalueof","$Node3")

//+ Node4: form1[0].Page1[0]

//+ Node3: form1[0].Page1[0].CurrentDate[0]

//+ Node2: form1[0].Page1[0].SubmittedON[0]

//+ Node1: form1[0].Page1[0].E-mailButton[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: E-mailButton.click

this.resolveNode("SubmittedON").rawValue = this.resolveNode("CurrentDate").rawValue;

this.resolveNode("SubmittedON").presence = "visible";

this.resolveNode("CurrentDate").presence = "hidden";

oTargetField = this.resolveNode("Page1");

    oTargetField.access = "readOnly";

//-

var cAdd = AdditionalNotes.rawValue;

var info = "Additional Notes for this request: ";

var EmpName = EmployeeName.rawValue;

var StrtDate = EffectiveDate.rawValue;

var Loc = Location.rawValue

var cBody = "The following is the completed New Employee Access Form for " + EmpName + " starting on "+StrtDate+" at "+Loc+ " .\n"+"\n" +info+cAdd;

if (cAdd == null){cBody = "Attached is the completed New Employee Access Form for "+EmpName+" starting on "+StrtDate+" at "+Loc+"."}

if (EmpName == null){

    EmpName = ""

    }else

    {

    EmpName = EmployeeName.rawValue

}

var myDoc = event.target;

try {

    myDoc.mailDoc({

        bUI: false,

        cTo: 'sbartholow@ppbi.com',

        cCc: 'khall@ppbi.com',

        cSubject: 'New Employee Form - '+EmpName+ " - " + StrtDate+ " - " + Loc,

        cSubmitAs: "PDF",

        cMsg: cBody

    });

} catch (e) {

}

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
Reply
Loading...
Aug 07, 2019 0
Most Valuable Participant ,
Aug 08, 2019

Copy link to clipboard

Copied

Are you making the form in LiveCycle Designer or in Acrobat? They need different scripts. And I repeat: why this dangerous try/catch?

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
Reply
Loading...
Aug 08, 2019 0
Most Valuable Participant ,
Aug 08, 2019

Copy link to clipboard

Copied

If this is an LCD form you should ask here: LiveCycle Designer

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
Reply
Loading...
Aug 08, 2019 0
Adobe Community Professional ,
Aug 08, 2019

Copy link to clipboard

Copied

Try this:

var myDoc = event.target;

try {

    myDoc.mailDoc({

        bUI: false,

        cTo: 'sbartholow@ppbi.com',

        cCc: 'khall@ppbi.com',

        cSubject: 'New Employee Form - '+EmpName+ " - " + StrtDate+ " - " + Loc,

        cSubmitAs: "PDF",

        cMsg: cBody

    });

} catch (e) {

     console.show();

     console.println(e);

}

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
Reply
Loading...
Aug 08, 2019 0