Skip to main content
Oct 16, 2019 11:39 AM UTC
Question

How to stop email client when requirement isn't filled

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 is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Oct 16, 2019 12:24 PM UTC

    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

    Translate
    try67
    Community Expert
    Community Expert
    Jan 5, 2020 2:10 PM UTC

    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 );
    }
    Translate