hello,
I have a ES4 form that I am working. I have added a row above a hidden table. This row has a button to open "show" a hidden table.
When clicked the table expands. the table has many cells. One cell has buttons to add new instance or hide the table itself. The add new instance upon click is not functioning. This is what breaks.
The hide table works fine.
If I try the same thing but with a table that is not originally hidden then it works fine. New instances occur. I need to reduce clutter on my form so it would benefit me to have it initially be hidden but then the add new instance has to work.
I use the action builder to add the javascript.
any advice?
thanks,
-Z
Views
Replies
Total Likes
this is the code for the add table button:
form1.DCtable.DCtablerow1.DCtableacell1.DCtableadd::click - (JavaScript, client)
//+ GENERATED - DO NOT EDIT (ID:F0FA29C1-D483-4F69-9B04-E7E69AD9FB64 CRC:2073942169)
//+ Type: Action
//+ Result2: SetPresence("$Node2","visible")
//+ Result1: AddInstance("$Node2")
//+ Node2: form1[0].DCtable[0]
//+ Node1: form1[0].DCtable[0].DCtablerow1[0].DCtableacell1[0].DCtableadd[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: DCtableadd.click
this.resolveNode('form1._DCtable').addInstance(1);
if (xfa.host.version < 8) {
xfa.form.recalculate(1);
}
this.resolveNode("DCtable").presence = "visible";
//-
Views
Replies
Total Likes
Hi,
don't get caught by adding new instance on hidden objects. Adding new instances copies the object as it is initially created with the form.
So if your table is initially hidden in the form and you add an instance to it, you will have to get that instance and put it visible
Views
Replies
Total Likes
do I add this to what I had in there or do I replace the last part with this?
Views
Replies
Total Likes
i tried replacing it and it is still broken.
this is the key part, right?
(DCtable[" + (_DCtable.count - 1).toString() + "])
Views
Replies
Total Likes
Hi,
Yes this line is to get the last instance of the table and then you set it to visible.
This code is for the purpose of adding a new instance of a Table only if the table is set to hidden by default.
If you are trying to add an instance of a row inside the table, this is not the right reference_syntax, you would have to addInstance to the Row1 inside the table.
Also make sure that you have the right reference to get access to the DCtable
Views
Replies
Total Likes
hrmmmm, still broken when I click add.
Views
Replies
Total Likes
Could you please take a screenshot of the hierarchy of the table and show it to me.
Identify as well which object you are trying to add an instance too.
You might have to add an instance to the row instead of the table.
If you are really trying to add an instance to the table you must set its maximum occurrence if there is none.
Views
Replies
Total Likes
here is the hierarchy:
here is the table:
here is the add button:
the same arrangement works fine if the table is initially visible. I only run into the problem when I want it to be hidden in the begining. having it be hidden will be the key to making the form manageable.
It may end up with forty headings with forty hidden tables with the ability to add new instances of any of them.
Also to hide half of them if they are not applicable.
The hide works fine. I had problems with remove an instance but I found that hide works fine. Would that cause problems down the line?
Thank you for taking the time to give it look.
-Z
Views
Replies
Total Likes
Hi sorry about, that seems like there was some syntax error in my code, it should be working with the following
Views
Replies
Total Likes
It works! thank you so much! I appreciate you for taking the time
Views
Replies
Total Likes
Views
Likes
Replies