Highlighted

addInstance not working on button click

Avatar

10-10-2008

I have a row table bound to a list on xsd and it is working fine, displaying all rows present on my xml.



I created a button in order to add rows to this table, for the user to fill in data. On the Javascript click event of the button I added the addInstance(true) with no success. However, the same code snippet is able to add instances of the row if placed on the initialize event of the same button!



This is the code:

TablePagamento._RowPagamento.addInstance(true);



So, why isn't the click event working but the initialize is?



By the way, my form has 3 different master pages, and I am beggining to think this is the problem, since I can make the above code work on a blank form with a single master page.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

10-10-2008

Are you defining your form as a dynamic form?
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

13-10-2008

My guess is that the subform TablePagamento is in a different context that the button so it cannot be found. Try pathing your way from the root all the way down to the subform.....so it should look something like this:



form1.Page1.TablePagamento._RowPagamento.addInstance(true);
Highlighted
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

14-10-2008

Can you post your form and any associated data files or schemas to livecycle8@gmail.com and I will have a look at it.
Highlighted

Avatar

Avatar

Luigi_247_365

Avatar

Luigi_247_365

Luigi_247_365

14-10-2008

Hi Marcelo,



It all has to do with (look here)



1) UPPER Subform CONTENT must be FLOWED

2) Min Occurence/Count & Max Occurence/Count

a) For Subforms check Binding Tab (Repeat Subform for each data item)

b) For Components Check Min Count & Max Count



If you have multiple Subforms within Subforms within Subforms...

definatly check the above two points, they will sort you out!



Advice.



Start a new document. Try it with one Subform. MAke it work, then add another subform that encapsulates the original subform and try make it work.. etc! until it represents your form structure! You will learn how the min/max works.