on 10-06-2008 8:43 AM
hi,
I have three fileds on the form by name ;
MONDAY_01.
MONDAY_02.
MONDAY_03.
I have another field by name TOTAL.
When the user enters a value in MONDAY_01 field ..
The field TOTAL should be updated.
and
When the user enters a value in MONDAY_02 field ..
The field TOTAL should be updated by adding MONDAY_01 and MONDAY_02 .
and
When the user enters a value in MONDAY_03 field ..
The field TOTAL should be updated by adding MONDAY_01 and MONDAY_02 and MONDAY_03.
Can you please tell me how to do this in JAVA SCRIPT??
Arjun,
That should be pretty starightforward. In calculate event of the TOTAL field keep the language as FormCalc and write the following code:-
Sum(MONDAY_01.rawValue,MONDAY_02.rawValue,MONDAY_03.rawValue)
PS: I am assuming all 3 fields are decimal fields.
Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Chitan,
Yes..I need in Java script only.
The reason is : I need TOTAL value by adding
MONDAY_01
MONDAY_02
MONDAY_03 .
When the value of field TOTAL excceds 24...I need to raise an error message.
So to raise an error message Iam using Javascript
if (TOTAL.rawValue > 24)
{
xfa.host.messageBox("Please enter a value less than 24");
}.
For adding ...Iam using Form calc
SUM(MONDAY_01 ,MONDAY_02 ,MONDAY_03 )
.
So here the problem is , I cannot use FORM CALC for adding and JAVASCRIPT for raising error message .
So Either I need both addition and raising error message in JAVASCRIPT or FORM CALC..
Can you please help
Arjun,
In calculate event of TOTAL field write following code in JavaScript:-
var val1 = 0;
var val2 = 0;
var val3 = 0;
if(MONDAY_01.rawValue != null)
{
val1 = parseInt(MONDAY_01.rawValue);
}
if(MONDAY_02.rawValue != null)
{
val2 = parseInt(MONDAY_02.rawValue);
}
if(MONDAY_03.rawValue != null)
{
val3 = parseInt(MONDAY_03.rawValue);
}
var total = val1 + val2 + val3;
if(total > 24)
{
xfa.host.messageBox("Please enter a value less than 24");
this.rawValue = "";
}
else
{
this.rawValue = total;
}
Chintan
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.