Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Variable Response Message Script

Avatar

Level 9

In the script below, everything works fine except when the first IF statement is true and the user clicks "Yes", the rest of the script (else if, etc...) does not fire. Originally I didn't have the section in red font but added it trying to solve this problem. Help would be appreciated...

Form1.Subform2.EmailButton::click - (JavaScript, client)

if (NoticeInfo.ExportClassification.rawValue == null || NoticeInfo.ExportClass.rawValue == null){

var nResponse = xfa.host.messageBox("You did not enter an export classification and/or select an export classification statement.\n\n Do you want to continue?", "Export Classification Blank", 1, 2);

if (nResponse == 3)

xfa.host.setFocus("NoticeInfo.ExportClassification");

if (nResponse == 4)

NoticeInfo.ExportClassification.rawValue == null;

}

else if (Subform3.NDAinPlace.rawValue !== "Yes"){

xfa.host.messageBox("The current NDA in place checkbox was left blank. Parts should not be sent to an external lab without current NDA in place.", "Current NDA in Place?", 0);

   xfa.host.setFocus("Subform3.NDAinPlace");

}

else{

var vSubject = "External Lab Engineering Request";

var vBody = "Instructions:"; 

event.target.submitForm({cURL:"mailto:?" + "subject=" + vSubject + "&body=" + vBody,cSubmitAs:"PDF",cCharset:"utf-8"});

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

That is how the script is set up. Even without checking the response of the messageBox, you have three main if/else statements:

if (first test condition) {

     messagebox script

}

else if (second test condition) {

     another messageBox script

}

else {

     submit form

}

So, if the first condition is met, the subsequent else if statement and the else statement will not fire.

You may want to move the email script into the if nResponse == 4 script.

Hope that helps,

Niall

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

Hi,

That is how the script is set up. Even without checking the response of the messageBox, you have three main if/else statements:

if (first test condition) {

     messagebox script

}

else if (second test condition) {

     another messageBox script

}

else {

     submit form

}

So, if the first condition is met, the subsequent else if statement and the else statement will not fire.

You may want to move the email script into the if nResponse == 4 script.

Hope that helps,

Niall