4 Replies Latest reply on Jun 22, 2017 3:38 PM by Zabrz

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

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

• ###### 1. Re: If Field A <= 15 then Field C = Field B

And if it's not?

• ###### 2. Re: If Field A <= 15 then Field C = Field B

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

• ###### 3. Re: If Field A <= 15 then Field C = Field B

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. Re: If Field A <= 15 then Field C = Field B

This worked perfectly! Thank you so very much!

Matt