-
1. Re: Calculation in Exit Event Problem
meem23 Feb 2, 2011 8:14 AM (in response to meem23)I tried another approach - I removed the scripts from allPlans35 and allPlans30 fields and added the following script in the lifeCharge field as a calculation event.
if
(allPlans30.rawValue == 0 || allPlans30.rawValue == null)
this.rawValue
= allPlans35.rawValue * 35;
else
if (allPlans35.rawValue == 0 || allPlans35.rawValue == null)
this.rawValue
= allPlans30.rawValue * 30;
Now what is happening is if you enter an amount in allPlans35 and change your mind and enter an amount in allPlans30, you have to manually delete the amount in allPlans35 to have the calculation work. Is this the way is has to be or is there a better solution.
Thanks
-
2. Re: Calculation in Exit Event Problem
Niall O'Donovan Feb 2, 2011 10:51 AM (in response to meem23)Hi,
There are a couple of approaches.
I am inclined to suggest the following javascript in the calculate event of the lifeCharge object:
this.rawValue = (allPlans35.rawValue * 35) + (allPlans30.rawValue * 30);
This is on the basis that the user can only place a value in allPlans35 OR allPlans30.
To achieve this have the following in the exit events:
allPlans 35 exit event:
if (this.rawValue != null) // allPlans35 { allPlans30.rawValue = 0; }allPlans 30 exit event:
if (this.rawValue != null) // allPlans30 { allPlans35.rawValue = 0; }Hope that helps,
Niall
-
3. Re: Calculation in Exit Event Problem
meem23 Feb 2, 2011 11:58 AM (in response to Niall O'Donovan)Hi Niall, thanks for your response. This does work if I mouse exit out of field allPlans35, however, if I keep tabbing it clears them.
-
4. Re: Calculation in Exit Event Problem
Niall O'Donovan Feb 2, 2011 12:25 PM (in response to meem23)Hi,
I am going to suggest a FormCalc script for the two exit events:
// if this field has a value, then clear the other field if (HasValue($) and $ ne 0) then allPlans30.rawValue = 0 endif
Here is an example:
https://acrobat.com/#d=sTbpBqlVu6jFqqM7jvRG*A
Hope that helps,
Niall
-
5. Re: Calculation in Exit Event Problem
meem23 Feb 3, 2011 8:33 AM (in response to Niall O'Donovan)When I tab out of field allPlans35, it acts very slow and then when I tab out of field allPlans30 I get a Runtime Error and the form closes.
-
6. Re: Calculation in Exit Event Problem
meem23 Feb 3, 2011 9:24 AM (in response to meem23)I think I got it. I added the following script to the exit event of allPlans30 and allPlans35.
if
(this.rawValue != 0) //allPlans35
xfa.host.resetData("xfa.form.form1.allPlans30");
if
(this.rawValue != 0)//allPlans30
xfa.host.resetData("xfa.form.form1.allPlans35");


