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

Hiding certain fields until add button is clicked.

Chayter
Registered: Mar 24 2011
Posts: 8
Answered

Hello, within my form I have a subform which has certain fields within it (text fields, drop-down list, check boxes). I would like to have this subform duplicated only when an "add" button is clicked (therefore, it is hidden until the "add" button is clicked). I have tried some different scripts but to no avail. To take it one step further, it would be great if I could have the subform in question completely hidden until a specific item from a drop-down list at the beginning of the form is selected. Thanks in advance for any help!

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
Set the number of initial instances of the subform to zero. Basically the subform won't exists until the first instance is added. Or you could mark it as hidden and then set the visibility by some other event, such as selecting the item from the dropdown, or clicking on the add button.

Have you seen this video? It covers the details
http://adobechats.adobe.acrobat.com/p87746471/

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Chayter
Registered: Mar 24 2011
Posts: 8
Thanks!
Chayter
Registered: Mar 24 2011
Posts: 8
Ok, so I have this working perfectly except I want the subform to appear when 1 of 2 options are selected from the drop-down list. I have it working perfectly for when one item is picked from the drop-down list using:
if(DropDownList2.xfa.event.change == "Farm"){
FarmBuilding.presence = "visible";
}
else{
FarmBuilding.presence = "invisible";
}
How to I add another item to this script so that when it is chosen from the drop-down list, this same FarmBuilding subform appears? ( I want the subform to appear when Farm is picked from the drop-down list and when Farm + IR is picked from the drop-down list).

Thanks!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If you have a list of constant values that make the subform visible, then use a switch statement.

switch(xfa.event.change)
{
case "Farm":
case "OtherThing:
armBuilding.presence = "visible";
break;
default:
armBuilding.presence = "invisible";
break;
}

if the values are not constant you'll need to create a more complex "if" statement.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Lhiz
Registered: Oct 11 2011
Posts: 1
Hi I would like to know if Acrobat has the feature of hiding certain text with password?

http://mediaparade.com/wp-content/uploads/2011/meliz-email-signature.jpg

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That's a very interesting question. The answer is yes and no. The PDF spec includes the ability to encrypt individual content streams. So yes, a single word (or any content) on a page could be placed into a separate content stream and encrypted, although I'm not sure that it could be done with a password. Acrobat is built to handle this situation. However, Acrobat does not contain any features for actually performing this type of encryption. Maybe a 3rd party has a tool for this.

Alternatively you could use a form field or annotation to cover the text, then ask the user to enter a password to un-hide it. This method isn't really secure, but would work for most users.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script