0

I'm trying to get this to work, but I just can't seem to get it. What I'm trying to do is that if the Score equals 3, then I want an X placed in the box. If it's anything other than a 3, then I want the box to be blank.

This is what I'm using, but it's not working.

var z = parseInt(this.getField("Score").value); 
if (z = 3) 
{ event.value = "X"; } 
else {
event.value = "";
}
Jordy
  • 53
  • 1
  • 9
  • Is "Score" a checkbox field or a text field? If it's a text field, then you just need to fix the comparison line. If "Score" is a checkbox field, then you need to be sure that the checked value in the field properties is also "X" or the field won't get checked. – joelgeraci Mar 08 '17 at 18:38

1 Answers1

1

You are using an assignment here:

if (z = 3)

not a comparison. There's at least one equal-sign missing. See also Which equals operator (== vs ===) should be used in JavaScript comparisons?

Community
  • 1
  • 1
Joachim Rohde
  • 5,915
  • 2
  • 29
  • 46