cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Form [print based] - Javascript to addup row

prabhu_s2
Active Contributor
0 Kudos

Hi,

I need to get the row total and display it in the form for which i need some help on java script. pls can anyone throw some light or some help on it?

Accepted Solutions (1)

Accepted Solutions (1)

rakesh_m2
Contributor
0 Kudos

Hi Prabhu,

Do you need table like below ?

C1C2Total
235
347
448

If yes, please use below script, if you are planning to use javascript

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++)

{
     if (fields.item(i).name == "C1")

      {
          total = total + fields.item(i).rawValue;
     }

    

     if (fields.item(i).name == "C2")

      {
          total = total + fields.item(i).rawValue;
     }

    

     if (fields.item(i).name == "Total")

      {
          fields.item(i).rawValue = total;

          total = 0;
     }

}

else,

please create table type in interface and in code initialization, calculate the total column and use it accordingly in form.

Thanks,

Rakesh

prabhu_s2
Active Contributor
0 Kudos

Hi Rakesh,

Yes that is the kind of scenario and yes i had implemented a logic much similar to the one u had posted but still not working...all am having is blank output. trying with table type and shall update if succesful

prabhu_s2
Active Contributor
0 Kudos

Used the table type as interface parameter and it worked but yet tried for the java script. I had the incorrect syntax used, referring to your code with added corrections on to it seems working, thanks Rakesh.

rakesh_m2
Contributor
0 Kudos

Good to know Prabhu.    Thanks for rewarding points

--

Rakesh

Answers (0)