Skip to main content
Known Participant
November 10, 2021
Question

check box changes the body of an email depending on status

  • November 10, 2021
  • 2 replies
  • 437 views

Hello,

 

Sorry I am new at this, and still attempting to get my head around java code!

 

I currently have a submit button that sends the form to an address with a ccd address, subject line and email body. I was wondering if I can change what is written in the body of the text depending if a check box has been ticked or not?

 

This topic has been closed for replies.

2 replies

BarlaeDC
Community Expert
Community Expert
November 10, 2021
John CorfAuthor
Known Participant
November 10, 2021

Hello,

I can get the form to be sent by email however, I would effectively like a different body written in the email depending on whether a tick box has been selected, i.e.:
(Tick box unselected) pop up comes up, user is asked if they want to continue, if they choose yes, the form will be emailed, and the body of the text will say something like "form not complete". if they choose no they can carry on filling out the form until it has been completed, then once complete they do not get the pop up, but the form is emailed.

Thanks

BarlaeDC
Community Expert
Community Expert
November 11, 2021

HI,

 

Are you able to share the form so we can see how you have set it up and then we can alter/suggest solutions based on how you are managing the flow at the moment?

 

A dialog can be easily shown using the code below ( lifted from the docs)

// A MouseUp action
var nButton = app.alert({
cMsg: "Do you want to close this document?", cTitle: "A message from A. C. Robat",
nIcon: 2, nType: 2
});
if ( nButton == 4 ) {
    this.closeDoc();
}

The options for the return values from app.alert are

1 — OK

2 — Cancel

3 — No

4 — Yes

 

Using this you can control the flow and allow the code to do what you want.

Bernd Alheit
Community Expert
Community Expert
November 10, 2021

Yes, this is possible.

John CorfAuthor
Known Participant
November 10, 2021

Excellent!

I have found an example form from here: https://acrobatusers.com/tutorials/popup_windows_part1/ which is very usefull although i think i lack the knowledge/ experiance to implement it to my code

 

this is the code I currently have:

if(this.getField("Serial No").value == "")

{

app.alert("Serial Number must be filled in");

}

else if (this.getField("WSJ PDI").value == "")

{

app.alert("PDI Job Number must be filled in");

}

else if (this.getField("WSJ Warranty").value == "")

{

app.alert("Warranty Job Number must be filled in");

}

else if (this.getField("Incomplete").isBoxChecked(0) == false)

{

event.target.checkThisBox(0, app.alert("PDI Incomplete, do you still want to email this sheet",2,2)==4)

//if the user clicks yes to continue I would like to send an email at this point

}

else

{

this.mailDoc({cTo: "Email 1", cCc: "Email 2", cSubject: this.getField("WSJ PDI").valueAsString, cMsg: " If Form is complete"})

}
;