cancel
Showing results for 
Search instead for 
Did you mean: 

scrpting exmaple for calculating sum

Former Member
0 Kudos

Hi Experts ,

I am using an interactive form in NWDS . I have to decimal input fields and third field is of sum , now i want a simple scrpting as user enters data in two decimal fields , so on entering data script should calculate sum and put it in sum field. Kindly give one of have solution to this or any scrpting exmaple.

Thanks in advance

Regards

sanjyoti

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Satyabrata

Thanks for reply very quick reply , but this script is not working

I am doubtful about the path ," data.page1.DecimalField1" an you tell me what exactlly this path is , am I doing something wrong in path ?

I have this script in both input field and i have selected run at both client and server .

var val1 = xfa.resolveNode("data.page1.DecimalField1").rawValue;

var val2 = xfa.resolveNode("data.page1.DecimalField2").rawValue;

xfa.resolveNode("data.page1.Decima4Field").rawValue = val1+val2;

Regards

Abhay

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I have just given one example ... <data.Page1>

instead of that you have to use your own node path ..

Goto Hierarchy you will get clear idea.

One more solution

In the script editor at the top you will find the node hierachy

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Anyway I have sent you the sample PDF file.Hope you will get the idea about the scripts for calculating the sum.

Cheers

Satya

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Any update to this or not.

Former Member
0 Kudos

hi Satya,

Sry was not able to reply to you.

anyways my probmel solved .

thanks,

Regards,

Sanjyoti.

Answers (1)

Answers (1)

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sanjyoti,

Solution using Java Scripts

Write the java script on Exit event of both the input fields

sample code

var val1 = xfa.resolveNode("data.page1.InputField1").rawValue;

var val2 = xfa.resolveNode("data.page1.InputField2").rawValue;

xfa.resolveNode("data.page1.InputField3").rawValue = val1+val2;

You have to go to the node <data.page1.InputField1> to get the value