I have a list of objects in a sub-form. They are hidden or made visible depending on the selection of a drop-down menu outside the sub-form. It works correctly for the first instance, but objects that are supposed to remain hidden become visible in all subsequent instances of the sub-form.
How do I make the objects remain hidden in all instances of the sub-form?
Views
Replies
Total Likes
Hi,
The objects you add to your form get their properties from the template model, the properties you update in your code are in the form model. So you will need to execute your code every time you add a new one. This can be done in the calculate event of the subform and then it will also react to any changes in the drop down.
So, something like this JavaScript in the calculate event of the subform (which uses a checkbox that is ourside of subform and hides or shows TextField2)
if (CheckBox1.rawValue == 1)
{
TextField2.presence = "hidden";
}
else
{
TextField2.presence = "visible";
}
Regards
Bruce
Views
Replies
Total Likes
Bruce,
The drop-down menu, not a checkbox, is in the header of the form. It contains approximately 10 values, each of which drives the presence of objects, not TextField2, in the Bottom_of_Form subform. Are you saying that I would have to put your script in approximately 100 places within my form for it to work correctly?
Views
Replies
Total Likes
Hi,
Maybe I am not understanding your problem. Is Bottom_of_Form the name of the subform that is repeating? If so this is were I am suggesting you put the code based on the sample above, into the calculate event. This code will need to handle the values of your drop down making the fields visible or hidden as required.
The code sample above was just meant to show you the approach to use, it was not meant to be a implementation of the solution (this is a reasonable common question and the first time I answered it they were using a checkbox).
I you need more help then we will need to see you form, so we can customise the code to your form structure.
Regards
Bruce
Views
Replies
Total Likes
My file is at https://www.dropbox.com/s/jr9yzsxrkvqenp5/EXP%20Sample%20Form.pdf
How do I keep them from popping up when I add Providers?
Views
Replies
Total Likes
I think you want to move all the code from the change event of form1.EXP_Sample_Form.Identifier.Who.LOB_List.LOB_List to the calculate event of form1.EXP_Sample_Form.Bottom_of_Form.
Which would then look like;
switch (Identifier.Who.LOB_List.LOB_List.rawValue)
{
case "AmeriHealth Caritas":
PCPInfo.Docs.SiteVisit.presence = "hidden";
PCPInfo.Docs.Comments_SiteVisit.presence = "hidden";
PCPInfo.Docs.SiteVisit_Received.presence = "hidden";
PCPInfo.Docs.PanelAttestation.presence = "hidden";
PCPInfo.Docs.Comments_PanelAttestation.presence = "hidden";
PCPInfo.Docs.PanelAttestation_Received.presence = "hidden";
break;
}
Here is your form with this suggestion made, https://workspaces.acrobat.com/?d=koCEYxi-59F7n5iyIoMhGQ
Bruce
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies