Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

addInstance not working on button click

Not applicable
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.
0 Replies
pguerett
Level 10
Level 10
Are you defining your form as a dynamic form?
Not applicable
Yes, it is dynamic and interactive.
pguerett
Level 10
Level 10
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);
Not applicable
Still not working, even with the full path
pguerett
Level 10
Level 10
Can you post your form and any associated data files or schemas to livecycle8@gmail.com and I will have a look at it.
Luigi_247_365
Level 2
Level 2
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.