How to calculate the number of row in a dynamic table | Community
Skip to main content
January 15, 2008

How to calculate the number of row in a dynamic table

  • January 15, 2008
  • 13 replies
  • 12875 views
Hi,

I've got a dynamic table where rows can be added by the user, in each row there's a checkbox cell. At the end of the table there's a "fixed" row where I have to count the number of the checked dynamic rows. How can I do that?



Thanks for your help.

Pascal.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

13 replies

November 24, 2008
If you are using Acrobat you can hit the Ctrl-J key to view the Javascript console. This will tell you if there is an error in your script.
December 2, 2008
Paul,<br />When I use the Javascript Console it gives me the following message:<br /><br />missing ) after argument list<br />9:XFA:form1[0]:Diario[0]:Button3[0]:click<br /><br />But I can't find the place where I should add the missing )<br /><br />Here is my script again (as it is currently):<br />-----------------------------------------------------------------<br />var rowIM=form1.Diario.Clocking.Row1.instanceManager.count+2;<br />var a=0<br />for(var i=0;i<rowIM.count;i++) <br /><br />{<br /> <br /> if(xfa.resolveNode("form1.Diario.Clocking.Row1["+i"].Function").rawValue="2") <br /> {<br /><br /> a++; <br /><br /> } <br />}<br />Diario.NumericField1.rawValue=a<br /><br />-----------------------------------------------------------------<br /><br />Can you give me any clue?<br /><br />Thanks<br /><br />Fabricio BRAGA
December 3, 2008
Two things I see right away ....the 9: in the error message indicates the line number where the error occurred. The reformatting of your code in this dialog makes it impossible for me to know which is line 9. You can right mouse click in the script editor and use the Goto Line option to get to th eright spot. Note that it coudl be on the previous line as well.



Second in javascript a comparison between two thing sis done using doube equal signs (==) and an assignment statement is done using single equal sign(=). In your if statement you are assigning the string 2 to the Row.Function ...you are not comparing the two strings ....therefore the code inside your if statement will never be executed.



Paul