Skip to main content
Participant
October 26, 2017
Answered

issues with if then javascript

  • October 26, 2017
  • 2 replies
  • 561 views

I am needing to have a script so that

if field a >0 than field b =150

else field be =0

This topic has been closed for replies.
Correct answer h_gewecke

The "then" term isn't used in javascript, just "if"... "else if"... "else"... ("else if" if you have more than the one case to check... though there's also "switch case" for that purpose).

if(this.getField("a").value>0) {

this.getField("b").value=150;

}

else

{

this.getField("b").value=0;

}

2 replies

Participant
October 27, 2017

Thank you so much

h_gewecke
h_geweckeCorrect answer
Participating Frequently
October 27, 2017

The "then" term isn't used in javascript, just "if"... "else if"... "else"... ("else if" if you have more than the one case to check... though there's also "switch case" for that purpose).

if(this.getField("a").value>0) {

this.getField("b").value=150;

}

else

{

this.getField("b").value=0;

}