If/Else Multiple Conditions - or Switch??
Am posting new info on a topic I posted in the wrong category (http://forums.adobe.com/thread/873889?tstart=0) in the hopes that moving it to correct category and providing new info will help. My form has a value field, and based on the values, radio buttons would be checked accordingly. The below working code is set as JavaScript on the calculate event of the radio box in question. All is well so far, it works fine.
The next step am trying to accomplish is that there is another radio box where they would check the Type - A, B or C. Except for a Type B, the below is in effect. However, if Type B is selected, regardless of value below, the classification should ALWAYS be set to "1". So a value of 1,000,000 AND marked as Type B would be classification 1, for example.
I believe the address of the radio group I need to test against is:
form1.sfrmMain.sfrmMainSub1.sfrmMain2.tbMainInfo.Row4[8].sfrmIdeaCAT.rType.rawValue;
But when I try to set a variable in below to use it in the code, it makes the other code not work. Any ideas how to approach this - is there a simpler way? Have checked into switch statements but have not been successful in converting below. Any ideas would be appreciated, thank you.
WORKING CODE:
var myVal = form1.sfrmMain.sfrmMainSub1.sfrmMain2.tbMainInfo.rowEstimates.tblEstimates.Row1.sfrmEstimates.nSavings.rawValue;
var myClass = form1.sfrmMain.rSavClass.rawValue;
if(myVal >= 1000 && myVal <= 9999)
{
myClass ="1";
}
else
if(myVal >= 10000 && myVal <= 24999)
{
myClass ="2";
}
else
if(myVal >= 25000 && myVal <= 99999)
{
myClass="3";
}
else
if(myVal >= 100000 && myVal <= 999999)
{
myClass="4";
}
else
if(myVal >= 1000000)
{
myClass="5";
}
else
{
myClass="0";
}


