


I have a form which has fields in it that are hidden/invisible when the form initializes. The form also has a button that can make the field appear under certain conditions using the following:
form1.Subform1.Subform2.TextField1.presence="visible";
But the problem occurs when I try to create a new instance of _Subform2.TextField1. Every time a new instance of TextField1 is generated, it will appear invisible/hidden as well.
How do you go about retreiving the name or reference of the newly generated textfield in order to set it to "visible"?
I am trying to catch it with a for loop, but it is currently not working:
var Subform2Length = Subform2.nodes.length;
_Subform2.addInstance();
for (var nCount = 0; nCount < Subform2Length; nCount ++)
{
if ((Subform2.nodes.item(nCount).className == "subform") & (Subform2.nodes.item(nCount).presence == "invisible"))
{
Subform2.nodes.item(nCount).presence="visible";
}
Any assistance is appreciated. Thanks.
Views
Replies
Sign in to like this content
Total Likes
Try like this in the event where you add the instance for Subform2..
Place it after you add a new Instance..
//Get the InstranceManager count and reduce it by 1. Because Index starts with 0.
var intNewIndex = form1.Subform1.Subform2.instanceManager.count-1;
form1.Subform1.ResolveNode("Subform2[" + intNewIndex + "]").TextField1.presence="visible";
Thanks
Srini
Views
Replies
Sign in to like this content
Total Likes
It worked like a charm. Thank you ver much!
For anyone that uses this: It didn't work initially but it was because the 'ResolveNode' argument was incorrectly capitalised. It should read "resolveNode" instead.
Srini,
I have a question about the code (I am not a programmer by trade and am trying to learn to make Livecycle easier to use):
What is the significance of placing the plus signs (+) around the 'intNewIndex' argument?
Views
Replies
Sign in to like this content
Total Likes
("Subform2[" + intNewIndex + "]")
I am using JavaScript as Language for this script. + sign in Java Script is used for String concatenation. I am concatenating Subform2 with current index in the parenthesis.
So for example, if the intNewIndex value is 1, then after the concatenation the code will look like..
("Subform2[1]")
Hope this helps..
Thanks
Srini
Views
Replies
Sign in to like this content
Total Likes