Expand my Community achievements bar.

Hiding form elements (setting them to visible / invisible)

Avatar

Former Community Member
Hi experts,



I would like to hide form elements (e.g. text fields) using a check box. All found examples do not work.



Here is an example:

The form contains a text field and a check box. After pressing the check box, the text field shall be hidden. I used the following code in the event "mouseUp" of the check box:



var myDoc = event.target;

myDoc.getField("textField").hidden = true;



With this code I get the following message in the JavaScript Debugger:



myDoc.getField("textField") has no properties



What can be the reason for this and how can the problem be solved?



I hope for your answers.



Thanks all together.



Thomas
10 Replies

Avatar

Former Community Member
You are using acroform commands and not xfa commands. Designer creates an XFA level PDF. Also you should use the exit event of the checkbox. Use this code instead:



TextField1.presence = "invisible";

Avatar

Former Community Member
when a field "hides" will othe elements shift up? same scenario as the original post with a slight twist. checkbox would show/hide a subform below it. when that subform is hidden, would any subforms below it move up to occupy the "blank" space?



thanks.

Avatar

Former Community Member
This depends on wether you are using flowing layout or not.

Avatar

Former Community Member
And, setting the visibility to "invisible" will NOT shift other fields up; it will just hide the field. If it's a flowed container and you want the other fields to shift up, then use "hidden" instead.

Avatar

Former Community Member
I am having similar problems. I am using the

TextField1.presence = "invisible";

and

TextField1.presence = "hidden";

to hide the fields. Changing the fields' presence to "invisible" just makes them read only, but does not hide them. Changing the fields' presence to "hidden" does nothing. To make them 'visible' again [even though they are always visible :( ], I use:

TextField1.presence = "visible";



I also have a label (a Text object) that I wish to hide and redisplay using the same technics. That was flagged as an error in forms designer, so I put a field and the label in a subform and tried to manipulate the presence of them by changing the subform's presence state. (ie: subformgroup.presence = "invisible";) This is a small step in the wrong direction, because the text field within the subform is no longer read only. The fields behave as desired in the form designer, but when uploaded to LiveCycle, their behavior is as described.



What do I need to do to correct this problem?

Avatar

Former Community Member
Go to Form properties (Under the File menu) and click on the Default Tab - what is the Traget version set to? Then click on the Preview tab and let me know what the settings on that panel are set to.

Avatar

Former Community Member
Paul,



Thank you for your quick response! Having re-read my previous posting, I realized I did not mention that I am using LiveCycle 7.x (LiveCycle 7.2 with Forms Designer 7.0 and Workflow Designer 7.0). The Target version information is not located in the File/Form Properties in LC Form Designer 7.0. I cannot find where that is specified in the 7.0 version. Where would I find the Target version in 7.0?



Thanks,

Frank

Avatar

Former Community Member
Can you post your email address and I will get you to send me your form. It has been a while since I used 7.x so I will have to refresh my memory. I did have this working in 7.x so I know it can be done.



I will be away until next week so don't expect a reply until then.

Avatar

Former Community Member
thanks for the update, i will also check the target version. i am attempting the same type of thing with hiding elements and collapsing those hidden areas

Avatar

Former Community Member
Paul and David,



My email address is ffuss19000401@yahoo.com. The form works correctly in Form Designer, but the fields remain invisible in LiveCycle. Thanks for you interest and assistance.



Frank