These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Submit and Reset Buttons

tsierra
Registered: Jul 24 2009
Posts: 43
Answered

Hello,

I have created "submit" and "reset" buttons for my Adobe Form in Acrobat 8. I just received a request to have a dialogue box or message pop up as soon as either one of these are clicked on.

The dialoge/message box would ask "Are you sure you would like to submit (or erase) your form?" and then give them an option to cancel or continue.

We would like this feature added in case someone changes his/her mind when submitting or resetting a form. Is this doable? If so, how can I go about creating such a feature?

Thanks in advance.

My Product Information:
Acrobat Pro 8.0, Macintosh
suewhitehead
Registered: Jun 3 2008
Posts: 232
I always use a message box with the reset button, just for the reason you stated. I also sometimes use a message box with an submit by email button. So here are the scripts that I use. The go on the ACtion tab, > mouse up > run a javascript. You can change the message inside the script to something that would work better for you.Also, if your submit is not openin a new email message with the form attached, as mine is, you would need to change "maildoc" to the command you want to use. Also notice that my Email button script has 2 message boxes, which yours does not have to have.

RESET Button

// display and get response - use the "?" Icon and "Yes/No/Cancel" return button
var cResponse = app.alert({cMsg: "All data will be cleared and all fields will be reset to BLANK.\n\nAre you sure you want to clear all the data?",
cTitle: "Reset Form",
nIcon: 2, nType: 1, });
if (cResponse == 1) {
this.resetForm();
}

SUBMIT BY EMAIL Button

var cResponse = app.alert ("Did you remember to sign the form?\n\nChoose YES to proceed or choose NO to go back and sign the form.",2,2);

if (cResponse ==4) {
var nResponse = app.alert("Don't forget to attach all pertinent receipts to the email.",3,0);
if (nResponse ==1); {
this.mailDoc(true);
}}
tsierra
Registered: Jul 24 2009
Posts: 43
Thanks for your help!
Sorry it took so long to respond. Haven't had a chance to check the web site. I will try these out and let you know what happens.
tsierra
Registered: Jul 24 2009
Posts: 43
Hello,

The Rest button script worked like a charm. Thanks!

I tried the Submit by Email script.
It worked, but how can I get it to 'auto-fill' the email address the form should be emailed to?
tsierra
Registered: Jul 24 2009
Posts: 43
Also, I would like the .fdf file attached to the email as well.

Thanks again for your help
suewhitehead
Registered: Jun 3 2008
Posts: 232
change the email button script to this:


SUBMIT BY EMAIL Button

var cResponse = app.alert ("Did you remember to sign the form?\n\nChoose YES to proceed or choose NO to go back and sign the form.",2,2);

if (cResponse ==4) {
var nResponse = app.alert("Don't forget to attach all pertinent receipts to the email.",3,0);
if (nResponse ==1); {
this.mailDoc({
bUI: false,
cTo: address,
cSubject: sub,
cMsg: msgBody,
cSubmitAs: "PDF"
});
}}


In place of "address" (after cTo:) put in the address you want the emails to go to. I am assuming you wnat them to go to the same address every time.
The form will be attached as a pdf.

Don't know anything about attaching an fdf file. you might try changing the above script from "pdf" to fdf. Or you could start a new post with that question.
tsierra
Registered: Jul 24 2009
Posts: 43
Hello,

Thanks again for all your help!
I was able to make the "Submit by Email" button work by using your script and customizing a bit.

FYI,
I did a bit of research and found the following information:
* app.mailMsg() – This function sends an e-mail message with no attachments.
* doc.mailForm() – This function sends the form data in FDF as a file attachment to the e-mail.
* doc.mailDoc() – This function sends the entire PDF file as an e-mail attachment.
* doc.submitForm() – This function can send form data in a variety of formats, including custom XML.


I just replaced the "this.mailDoc" in your script with "this.mailForm" and it attached the fdf file instead.

Thanks again!