Expand my Community achievements bar.

SOLVED

'OR' operator is not working in 'IF' condition!

Avatar

Level 8

Hello,

I am trying to put some validation/code, by using the 'IF' condition as below with 'OR' operator, but, its not working(am not getting any syntax erorr), pls. let reframe correctly, pls. note that 2 periods after my_form, am using it to point the text object/drop-down, bcz until run time i dont know the object's name


if ((xfa.resolveNode("my_form.." + myArrayReq[i]).rawValue == null) || (xfa.resolveNode("my_form.." + myArrayReq[i]).rawValue == "")){

// my code come here, like populate some variable

};

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Glad its working. In relation to the array, I just could not see the rest of the script, in order to see the lead in to the if statement.

Niall

View solution in original post

3 Replies

Avatar

Level 10

Hi Srinivas,

Try moving the xfa.resolveNode out of the if statement and use a variable.

In addition if you use the tripple equal sign for testing that two operands are identical, you can then omit == null AND == "".

var myVariable = xfa.resolveNode("my_form.." + myArrayReq[i]).rawValue;

if (myVariable === null) {

   // your code

}

Also the way you are passing the array through the xfa.resolveNode may be incorrect. Test using console.println or an app.alert.

Good luck,

Niall

Avatar

Level 8

Thank you.

Also the way you are passing the array through the xfa.resolveNode may be incorrect. Test using console.println or an app.alert.

For me, its working, yes i tested it, its fine.

Any comments?

Thank you

Avatar

Correct answer by
Level 10

Glad its working. In relation to the array, I just could not see the rest of the script, in order to see the lead in to the if statement.

Niall