I have the identical code (see below) in the click-event of two buttons: one on the master page, the other on the text page.
The code on the text page works fine.
The code on the master page produces a "Form1 is undefined" error. The cause for the trouble is clearly the submitForm() - without it the presence change works perfectly.
It appears that the submitForm() triggered from master page events destroys the internal object structure - the whole form is not found any more by the code.
Do you have any idea how to prevent this?
Has anyone else observed this problem?
I have an example form at hand if anyone is interested.
------
Form1.myPage.mySubform.presence = "hidden";
sAddress = "baehr@paperless-process.de";
sSubject = "Test eMail";
sBody = "Please see my empty PDF!";
sType = "PDF";
sendPDF(sAddress, sSubject, sBody, sType);
Form1.myPage.mySubform.presence = "visible";
//#################################################################
function sendPDF(sAddress, sSubject, sBody, sType) {
// Purpose:
// Sends the PDF form as an eMail.
// Parameters:
// sAddress a correct eMail address
// sSubject the eMail's subject. May contain umlauts etc.
// sBody the eMail body as a string. May contain umlauts etc.
// sType either "XML" or "PDF"
// Result:
// -
// Prerequisites:
// -
//
// Author:
// 27.04.15 Ulrich Bähr (www.paperless-process.de):
var currentDoc;
if (typeof(xfa) == "object")
currentDoc = event.target;
else
currentDoc = this;
var sURL = "mailto:" + sAddress + "?subject=" + sSubject + "&body=" + sBody;
currentDoc.submitForm({
cURL:sURL,
cSubmitAs:sType,
cCharset:"utf-8"
});
} // sendPDF()
//#################################################################