Expand my Community achievements bar.

Trouble with Radio Button Script to Make Table Appear/Disappear

Avatar

Level 2

Hello, These forums are a livesaver! Thanks for many many solutions and learnings. I'm currently stuck and I couldn't find anything to help me work out my script for making a table appear and disappear when a radio button is selected/deselected. There are 2 options for the radio button and I am using the following jave script (on click) to control the table which is hidden in the same subform as the radio buttons:

if

(xfa.resolveNode("copycheckbox3[0]").rawValue == 1)

{

ChainofCustodyTable.presence

= "visible";

}

else

if(xfa.resolveNode("copycheckbox3[0]").rawValue == 2)

{

xfa.resolveNode("ChainofCustodyTable").presence

= "hidden";

}

The form is dynamic and flowed and when I select the radio to make the table appear, a gap opens on the form, but the table is not visible. Also, when I select to other radio button, the gap does not go away. Below is the message in the Java Console. If anyone can point me in the right direction, I would sincerely appreciate it. I can e-mail the form if it makes sense. Thanks very much!

GeneralError: Operation failed.
XFAObject.setInstances:7:XFA:LegaleDiscoveryForm[0]:PageSubform[0]:ActiveDirectorySubform[0]:Table2[2]:Row1[0]:#subform[0]:RadioButtonList[0]:chainboxyes[0]:enter
The element [min] has violated its allowable number of occurrences.


xfa.resolveNode("copycheckbox3[0]") has no properties
1:XFA:LegaleDiscoveryForm[0]:PageSubform[0]:ActiveDirectorySubform[0]:Table2[2]:Row1[0]:#subform[0]:RadioButtonList[0]:click
otherCopycheckbox2 is not defined
3:XFA:LegaleDiscoveryForm[0]:PageSubform[0]:ActiveDirectorySubform[0]:Table2[2]:Row1[0]:#subform[0]:RadioButtonList[0]:Chainboxno[0]:change
xfa.resolveNode("copycheckbox3[0]") has no properties
1:XFA:LegaleDiscoveryForm[0]:PageSubform[0]:ActiveDirectorySubform[0]:Table2[2]:Row1[0]:#subform[0]:RadioButtonList[0]:click

8 Replies

Avatar

Level 10

I noticed two issues.

1. I think you have set some larger value than 1 in the min occurance.

2. The checkbox is not in the appropriate location.

Its better if you could post your form for a review.

Nith

Avatar

Level 2

Nith, Thanks for taking a look at this. I checked and the min occurance value on the table and it appears to be set at 1. I've attached the form. The last radio button set (chain of custody) is the culprit. Thanks again, Todd

Avatar

Level 10

See the modified document check check if this is what you expected.

Nith

Avatar

Level 2

When I try the radio button, it still only expands the subform like it is trying to display the table, but the table is not visible. When I deselect the radio button (by selecting the other option) it does not hide the expanded area in the subform. Does it behave differntly for you?

Avatar

Level 2

Update: I modified the script slightly (below) and am now able to cause the hidden table to appear on selecting the radio button, but still cannot get it to disappear if the other option is selected. The desired result is that toggling between the two radio button choices will make the table appear & disappear.

if

(this.selectedIndex ==1){

ChainofCustodyTable.presence = "invisible";

this.resolveNode("_ChainofCustodyTable").setInstances(0);

}

else

{

this.rawValue;

ChainofCustodyTable.presence = "visible";

this.resolveNode("_ChainofCustodyTable").setInstances(1);

}

Any direction would be a huge help as I am stuck. Thanks!

-Todd

Avatar

Level 10

I just explained how to locate your field in the form. Since you have used more than one radio button group, it caused a problem in locating the radio button values.

You need to write the logic to hide the form if you select the other radio button option.

Cheers,

Nith

Avatar

Level 10

Post your form with the updated code. I will try to resolve the issue.

Nith

Avatar

Level 2

Aha, I did not nealize that I also needed a script on the onther radio button. Not sure why, but I was assuming that once the buttons were grouped, the scripts were aplies accross the group. I got it working by adding a chage script to remove the table when that radio button is selected. Thanks for you help! -Todd