Hi,
I included a Submit & an Email button in some of my forms. I've set them up as Regular buttons and coded them myself to do what I want eg:
if(xfa.host.messageBox("Please save this form before emailing or data will be lost","Save Form",1,1))
app.execMenuItem("SaveAs");
var sEmail = form1.Pg2.PtESF.Mgremail.rawValue;
var sSubject = ("Permit to Train Request by " + form1.Pg1.PtASF.FirstNameFld.rawValue + " " + form1.Pg1.PtASF.LastNameFld.rawValue);
var sBody = "Please approve the Permit to Train Request as attached.";
event.target.submitForm({cURL:"mailto: "+ sEmail +"?subject=" + sSubject +"&body=" + sBody,cSubmitAs:"PDF",cCharset:"utf-8"});
If I set them up as Submit buttons, they don't try to run the script more than once. I assumed this was because I had the code built in with the Submit option and it ran that as well as my own code.
So I changed the button to be a Regular button and then it worked perfectly - except for one thing.
It no longer validated the mandatory fields.
Can anyone tell me what's built into the Submit button (that I can't see), that I need to reproduce in my script for my regular button?
Thanks,
Peta
Views
Replies
Total Likes
Hi,
The Submit buttons validate the from behind the scenes.
You can use execValidate() in an if statement, and if passes then execute script.
See an example here for execValidate():
http://assure.ly/hM2A5y (see last button)
Both of the above examples use validationState and cancelAction so are targeted to Acrobat/Reader version 9.1. Please note that execValidate() can be used in earlier versions:
Hope that helps,
Niall
Views
Replies
Total Likes
ah thanks Niall, I'll get reading and get back to you.
Peta
Views
Replies
Total Likes