Skip to main content
Zabrz
Participant
June 22, 2017
Answered

If Field A <= 15 then Field C = Field B

  • June 22, 2017
  • 4 replies
  • 479 views

So the topic of this thread is basically what I'm trying to accomplish with Javascript. I've tried a lot of things from similar questions on the internet but I can't get this to work. So here's what I'm working with and what I'm trying to accomplish:

Here are the names of the fields that I'm working with:

Field A = DaysInMonth

Field B = TotalMonthlyFee

Field C = NextMonth

Field C is where the Javascript will be done. This is what I want it to do:

If Field A is less than or equal to 15 then grab the value in Field B and place it in Field C.

Can anyone write javascript that will accomplish this?

Thank you so much,

Matt

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer try67

As the custom calculation script of C enter this code:

var a = Number(this.getField("A").value);

if (a<=15) event.value = this.getField("B").valueAsString;

else event.value = 0;

4 replies

try67
Community Expert
Community Expert
June 22, 2017

And if it's not?

Zabrz
ZabrzAuthor
Participant
June 22, 2017

If Field A is not less than or equal to 15 then Field C can = 0 or be left blank

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 22, 2017

As the custom calculation script of C enter this code:

var a = Number(this.getField("A").value);

if (a<=15) event.value = this.getField("B").valueAsString;

else event.value = 0;