Need script to hide table rows - this does the problem no justice - LiveCycle ES2

deliashea 20-01-2016

I am developing a dynamic form.

There is a RadioButtonList that depending on the option (1,2,3), will open a Subform (1,2,3). Each Subform contains a different set of checkboxes. The checkboxes for each Subform (1,2,3) are tied to a different Subform (5,6,7). Subforms 5, 6, and 7 all contain tables. The checkboxes in Subforms 1, 2, and 3 are tied to the rows in the tables in Subforms 5, 6, and 7. All rows of all tables are set to "hidden". When checking a checkbox, the associated row of the associated table has its presence changed to "visible".

Example:

RadioButtonList1 = 1

Subform1 is displayed.

CheckBox3 = 1

Subform5.Table1.Row3 is displayed.

This all works perfectly. I am sure it is convoluted, but the end result works.

Here is what I need: I need a way to re-hide whatever was set to "visible". Here is what I have tried:

RadioButtonList1::click - (JavaScript, client)

xfa.host.resetData("xfa.form.form1.Subform1"); &2 &3 &4 &5 &6 &7

xfa.form.recalculate();

xfa.form.remerge();

It clears the contents of the table, but does not hide it from view. I don't want to have to manually set all table rows to "hidden" - there are 156 of them (don't judge me!). Is there a script that can find any rows that are not hidden, and re-hide them? Thanks in advance.

Cheers

Accepted Solutions (1)

Accepted Solutions (1)

deliashea 20-01-2016

Let me add this. The scripting to show the fields lies with the radio buttons. It looks something like this:

form1.Subform1.CheckBox3::change - (FormCalc, client)

if ($.rawValue==1) then form1.Subform5.Table1.Row3.presence = "visible" else form1.Subform5.Table1.Row3.presence = "hidden" endif

Would it help if I moved the scripting to the row on the table? For example:

form1.Subform5.Table1.Row3::change - (FormCalc, client)

if (form1.Subform1.CheckBox3==1) then $.presence = "visible" else $.presence = "hidden" endif

I don't know if that would make any difference or not. Any thoughts would be greatly appreciated.

Answers (2)

Answers (2)

deliashea 20-01-2016

Ok. I have figured this out. I am not sure why it works, but I am sure that it works. I tried moving the script from the CheckBox to the Row of the table. I think because the field is referencing a different field (rather than itself) in the "if" part of the statement, that is what allows it to work. If someone could provide an explanation as to why, that would still be awesome!

Magus069
MVP
20-01-2016

Hi there,

Basically, I'd say remerge is suppose to do exactly what you want.

I am not quite sure why it is not resetting the visibility of your rows, even if you try remerge alone?

Otherwise, you could create a recursive function that loops through each subforms and search for a row that its visibility is initially set to hidden and set them to hidden.

Hope this will help