Skip to main content
annab387
Participant
August 23, 2017
Question

Simple Java not working

  • August 23, 2017
  • 1 reply
  • 224 views

I'm sure there's an exceedingly simple answer I'm missing, but I can't seem to get this to work right.  All I want to do is subtract 2 from the sum value if the radio button ABCs is marked "NA" but it seems that no matter what I do, it still displays 8.

Name: ABCs

Radio Button Choice: NA

Here was my best shot:

(function () {

    var sum = 8;

if(ABCs.value == "NA"){

sum = sum -2;}

else {sum = sum;}

    event.value = sum;

})();

Thank you for your help!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
August 24, 2017

1. It's JavaScript, not Java.

2. I moved your question to the JavaScript forum

3. Your code has some mistakes in it. Use this instead:

(function () {

    var sum = 8;

    if (this.getField("ABCs").value == "NA") {

        sum -= 2;

    }

    event.value = sum;

})();

annab387
annab387Author
Participant
August 24, 2017

Thank you for the clarification regarding nomenclature.

Your assistance with the javascript is much appreciated and I can now make this project work.

I shall now rejoin the ranks of the programming neophytes and endeavor not to darken your forums with further puerile inanity.