Expand my Community achievements bar.

Drop-down to drive visibility of subforms

Avatar

Former Community Member
I'm new to LiveCycle and I think I need Java to do what is needed.

This is a product development information form. I have a "Category" drop-down with 15 selections. There is a large section of the form that will contain one of 15 different subforms depending on which category is choosen from the drop-down.



I know java will allow me to make the correct subform visible through the presence option, however I have very little experience with java.



If the user makes a selection in the drop-down, then goes back and changes to a different selection, the first subform displayed would need become hidden and the correct one visible.



The placement of the subforms is working ok by using the flowed option, just need help to get it linked to the drop-down.



Thanks in advance .....

Keith
3 Replies

Avatar

Former Community Member
So at a time you only need one subform to display?

Try this code on the drop down(on change):



if(this.selectedIndex == 1){

subform1.presence = "visible";

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

}

else{

subform1.presence = "invisible";

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

}

this.rawValue;



and continue with the display of other subform in the else if statement.



Hope this helps.

Avatar

Former Community Member
I tried this script, but get message it failed. Can someone relate this script to my example? I have two options in my drop down with the first being "contract" and second being "purchase order" and the different text boxes I want displayed are in Subform1 and 2 respectively.



Would greatly appreciate the help,

Adam

Avatar

Level 2

Hi, I set mine up similarly to this thread and it works great for one subform but when I add more, it falls apart. Here's what I'm doing, I think my issue is with the else if syntax necessary to add additional subform hide/visible statements which correspond to the other drop down selections (fyi, there are 14 total in my dropwdown menu and I have been testing with raw values 11 & 3):

if

(this.selectedIndex == 11)

{

ActiveDirectorySubform.presence = "visible";

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

}

else

{

ActiveDirectorySubform.presence

= "hidden";

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

}

if

(this.selectedIndex == 3){

AssociatemachineSubform.presence

= "visible";

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

}

else

{

AssociatemachineSubform.presence

= "hidden";

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

}

this.rawValue;

Can someone please help me get this right?

Thanks!!!!