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

JavaScript: Help with IF Statement

Avatar

Level 2

I am not familar with Java and I have been fighting with this IF statement and I cannot get it to work.  I am sure it is something fairly basic.  Can anyone help?  I have seeminly tried everything.  In this example below I am trying to check if the data the user has entered in the FAVOR field is AAA and if it is then put up a message and if it isn't then put up a different message.  My top node in my hierarcy is data and then I have a MainSubform and then a Contact02Subform.  I have this code attached to a button and notthing happens when I click the button.  If I remove the if statement and just have the message box by itself then it shows the message box.  So I know it is my IF statement and I am sure it is simple.  Help please?

 

if

(xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.FAVOR").rawValue == 'AAA')

{

  xfa.host.messageBox("My IF");

else;

  xfa.host.messageBox("My ELSE");

endif;

1 Accepted Solution

Avatar

Correct answer by
Level 9

Try this.

if (xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.FAVOR"). rawValue == 'AAA')

     {

          xfa.host.messageBox("My IF");

     }

else

     {

           xfa.host.messageBox("My ELSE");

     }

endif is used in FormCalc generally not in JavaScript.

Thanks,

Bibhu.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

Try this.

if (xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.FAVOR"). rawValue == 'AAA')

     {

          xfa.host.messageBox("My IF");

     }

else

     {

           xfa.host.messageBox("My ELSE");

     }

endif is used in FormCalc generally not in JavaScript.

Thanks,

Bibhu.

Avatar

Level 2

Thank-you!!  I knew it was simple.  I did have the { in other things I tried, but I must have removed them at somepoint in trying to get other things to work.  And for us folks who have been around for a while it is just insstinctive to put an endif in