Hi Guys
I trying to make a form, where the user can enter a numeric ranged value in field1 which will then equal a specified percentage value in field2.
eg
if a numeric value between 1 to 10 is entered in field1 then field2 will equal 100%
if a value between 11 to 20 is entered in field1 then field2 will equal 20%
if a value between 21 to 30 is entered in field1 then field2 will equal 25%
if a value between 31 to 40 is entered in field1 then field2 will equal 30%
if a value between 41 to 50 is entered in field1 then field2 will equal 35%
etc,etc,etc
any help with scripting this will be great. Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
You can use the switch case statement in Java Script to achieve this.
Copy the below code to the exit event of one Numeric field which will assign value to an other Numeric Field (NumericField2) ..
var intValue = this.rawValue;
switch (true){
case ((intValue>=1) && (intValue<=10)):
NumericField2.rawValue = 100;
break;
case ((intValue>=11) && (intValue<=20)):
NumericField2.rawValue = 20;
break;
case ((intValue>=21) && (intValue<=30)):
NumericField2.rawValue = 25;
break;
case ((intValue>=31) && (intValue<=40)):
NumericField2.rawValue = 30;
break;
case ((intValue>=41) && (intValue<=50)):
NumericField2.rawValue = 35;
break;
default:
xfa.host.messageBox("else");
}
Views
Replies
Total Likes
You can use the switch case statement in Java Script to achieve this.
Copy the below code to the exit event of one Numeric field which will assign value to an other Numeric Field (NumericField2) ..
var intValue = this.rawValue;
switch (true){
case ((intValue>=1) && (intValue<=10)):
NumericField2.rawValue = 100;
break;
case ((intValue>=11) && (intValue<=20)):
NumericField2.rawValue = 20;
break;
case ((intValue>=21) && (intValue<=30)):
NumericField2.rawValue = 25;
break;
case ((intValue>=31) && (intValue<=40)):
NumericField2.rawValue = 30;
break;
case ((intValue>=41) && (intValue<=50)):
NumericField2.rawValue = 35;
break;
default:
xfa.host.messageBox("else");
}
Views
Replies
Total Likes
Thanks Sirini, that works great!!!!!
Views
Replies
Total Likes
Views
Likes
Replies