Skip to main content
October 16, 2019
Question

How to stop email client when requirement isn't filled

  • October 16, 2019
  • 1 reply
  • 258 views

I use a javascript on a button to create an email when pdf formular is filled.

to check if a digital sign is given I use:

var dSign = this.getField('FKDigSig').value;

if (dSign.value == "") {
app.alert("Please check if you have digital signed the form!");
}

var email = 'a.b@domain.com';
var ccmail = this.getField('FK-Mail').value;
var subjectline = 'requested pdf';
var body = 'Hello,\n\nattached you'll find the filled form\n\nGreetings!\n';
this.mailDoc(false, email, ccmail, "", subjectline, body );

 

But if the digital sign is not filled, the alert comes up and if I enter it by ok, then the email client starts with all details and attached file.

I need to have a break here!

So if I enter the js-alert by clicking the Okay-button, the email client shouldn't start. The PDF should stay open to get fullfilled till the dSign-Field got a value by a digital signing.

 

How to realize this?
Thanks&Greetings from Berlin,
Wollehaufen

    This topic has been closed for replies.

    1 reply

    October 16, 2019

    Additionally I found out, that  the 'this.getField' will not really grab the value of 'dSign' because pushing ' + dSign + ' inside the alert will not give any value in the alert message. Only ' + dSign + ' will be shown as content if a digital Sign is filled in and check is changed to if (dSign.value != "") 

     

    var dSign = this.getField('FKDigSig').value;

    if (dSign.value != "") {
    app.alert("Please check if you have digital signed  ' + dSign + ' the form!");
    }

     

    So probably nothing on this really works.

    Any help will be more then welcome and appreciated!
    wollehaufen

    try67
    Community Expert
    Community Expert
    January 5, 2020

    Your last code doesn't make sense. To do what you described you just need to place the code the submits the form into an else-clause, like this:

     

    var dSign = this.getField("FKDigSig").valueAsString;
    if (dSign.value == "") {
    	app.alert("Please check if you have digital signed the form!");
    } else {
    	var email = "a.b@domain.com";
    	var ccmail = this.getField("FK-Mail").valueAsString;
    	var subjectline = "requested pdf";
    	var body = "Hello,\n\nattached you'll find the filled form\n\nGreetings!\n";
    	this.mailDoc(false, email, ccmail, "", subjectline, body );
    }