These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Radio to control visability of table in subform

keepitfrozen
Registered: Feb 20 2008
Posts: 8

I'm going to try and explain this as clear as possible so if i loose someone i'll try and try again. :)

Ok, here what i have now.

i have a dynamic form with a subform containing a table that can be repeated with a "Add Button" that is also in the same subform. When i choose the "Add Button" the subform gets duplicated via the instanaceManager script that i'm using.

form1.page1.room.instanceManager.addInstance();

All this works great and there are no problems. Sales wants me to add another table to that same subform that holds the first table but they also want me to add a radio button set "yes/no" to the same subform and when i choose yes have the second table show up only under those instances of the of the form where the "yes" radio is selected. Hummmm..

Ok so I've done something like this with check boxes but it was more of a matter of just hiding and showing "hidden from layout" text fields, using the following code on the "Java Code" on the "change even".

if(this.rawValue==1)
{
page1.edge.presence="visible";
}else{
page1.edge.presence="hidden";
}

But this doesn't seem to work with radio buttons and i even tried it with check boxes (although i would prefer use radio) but when you uncheck a box that is in say "instance number 3" that was added it hide the table on "instance number 1" which i guess sort of makes sense looking at the code. So i guess this needs to be done with the instanceManager some how but i can't say for sure how i would go about doing this and I"m certainly no master java programmer. :)

I would sure appreciated any help and i'll owe you a cold one.

thanks,

Mark

My Product Information:
LiveCycle Designer, Windows
keepitfrozen
Registered: Feb 20 2008
Posts: 8
Ok, i figured out how to hide and show the nested subform using the radio buttons.

I have 2 radio buttons that have a single question applied to them and one button is yes and the other is no.

"yes" radio button displays the second nested subform that holds the optional table.

Java Script for Yes radio:

On click Event:
_plumbing.addInstance(1)

"no" radio button removes the second subfom that holds the optional table.

Java Script for No radio:

On click Event:
plumbing.instanceManager.removeInstance(this.parent.parent.index);



On the binding tab for the nested subform/table i set the "Repeat Subform for Each Data Item" too:

Min Count: Unchecked <-- setting this to zero removes the check.
Max Count: Checked and set to Max: 1
Initial count: Unchecked <-- setting this to zero removes the check.All this works great and is pretty much doing what i need but i have one problem.


All of this is placed inside of a main subform that holds another table and has a Add and Delete button for the entire subform including this nested subform and table.

Here's what's happening:

Let's say i add another main subform/table then choose yes to the radio button for that second instance of the main subform table. this makes the second nested table show up as expected but let's say i delete that second main subform/table while the nested subform/table is present then the nested subform/table doesnt get removed it jumps to the first visible table.

I need to figure out how to make the delete button select or run the javascript that is applied to the "No" radio button before it removes the instance of the main subform/table..

I would appreciate any ideas on how i could remedy this issue.

thanks,

Mark