Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

else if statement help

kevin3954ga
Level 3
Level 3

Okay I am getting pretty good at the "if" statement and the "else" statement as well. But what do I do if I need 2 conditions to be met before something is done on my form. I am going to do my best to explain what it is I am trying to do.

I want radio2 to change its value to 2 when radio1 has a value of 2. But radio1 performs a different calculation in numericfield1 then radio2 does in numericfield2.

basically what I am doing is designing an estimate guide for a flooring business. (Working on the carpet section right now) Problem is, that carpet comes in 2 different widths. 12 wide carpet and 15 wide carpet. Most of my customers have no idea what width of carpet they will choose at the time I am at their home measuring for carpet. So I am giving them different estimates for each. But rather then have to fill out a whole separate form for 15 wide carpet I want the simple selections such as whether or not we are moving furniture or pulling carpet out to automatically be filled out in the 15 wide section of the estimate as I answer the questions in the 12 wide section. But here is the catch. Some of my customers are 100% sure they are choosing 12 wide carpet (or 15 wide for that matter). So I do not want the calculations done unless a checkbox has been checked so it does not confuse my customers. Thanks for any help 

1 Accepted Solution
Niall_O_Donovan
Correct answer by
Level 10
Level 10

Sorry, now I see it:

this.rawValue = cost15wide.rawValue * qty15wide.rawValue;

You need .rawValue when accessing the value of all objects.

Hope that works,

Niall

View solution in original post

6 Replies
kevin3954ga
Level 3
Level 3

I think I found a way to make it work without an else statement by putting the script into the numeric field where the calculations are to be done. I must be doing something wrong though because its not working even when it seems like it should.. grrr Here is my best shot at it.

if(carpetSUB.width15.rawValue ==1) // width15 is the checkBox, carpetSUB is the subform the checkbox is located in

{

this.rawValue = cost15wide * qty15wide;

}

else

{

this.rawValue = "0.00";

}

Okay so why is it not working? Anyone?

Niall_O_Donovan
Level 10
Level 10

Hi,

Would recommend that you use the Javascript Console when previewing the form in LC Designer / Acrobat.

Press Control+J:

Parallels Desktop2.png

Also there is a syntax check button just above the script editor.

Good luck,

Niall

kevin3954ga
Level 3
Level 3

Yeah I did that 100 times thinking something is wrong. It does not recognize a problem, but yet the calculations still do not work. I am not getting any errors when I test the form. It just plain wont work I am going to keep plugging at it until I find a work around. Thanks though for your time... I am persistent, I will get it

Niall_O_Donovan
Correct answer by
Level 10
Level 10

Sorry, now I see it:

this.rawValue = cost15wide.rawValue * qty15wide.rawValue;

You need .rawValue when accessing the value of all objects.

Hope that works,

Niall

View solution in original post

kevin3954ga
Level 3
Level 3

You are amazing! Thanks Sad thing is... I KNEW that but just did not see! Thanks again