Multiple Text field layer
Copy link to clipboard
Copied
Hi,
I have a document that has drop down field with multiple options and each option has multiple different text fields that need to be filled out. My first thought was to layer the text fields and show/hide them based on the drop down selection however this is getting messy as I have 12 drop down choises to chose from and each on has different show/hide text fields.
Is there an easier way utilising layers and have different layers show up depending on the drop down box? or can i shif the text around to come up to the area?
Any advice would be greatly appreciated.
Copy link to clipboard
Copied
It's not very understanding what you try to achieve from your post.
Why would show/hide fields be more messy than show/hide layers?
Couldn't you use the same fields and change what text is displayed depending on choice?
Copy link to clipboard
Copied
Fields and layers exist separately from one another (for the most part), so it's not an either/or situation.
If you want to change both the static layout of the page and the interactive elements in it you need to show/hide both of them, independently of one another. If you name them correctly, though, this shouldn't be too difficult to do.
Copy link to clipboard
Copied
It's actually possible to attach fields to a layer. InDesign offers this functionality.
Also, I wrote a tool for it, and the download is here:
(however it is for members of the site)
Otherwise, if you want to simplify the messiness, then generalize your approach to the solution by making more it more indirect. You haven't said, but I imagine you've brute force hard coded the hide and show operations. A neater approach is to use an object to store the field/text configuration for each selection. This separtes the operation from the configuration data. So now the configuration data can be written in a way that is easy for you to both see and modify.
for example:
var oDataConfigs = {"Dropdown Choice 1":[{bField:true, cName:"TextField1", bHidden:true}, {bOCg:true, cName:"Layer1", bHidden:true}, .... etc....],
"Dropdown Choice 2":[{bField:true, cName:"TextField1", bHidden:true}, {bOCg:true, cName:"Layer1", bHidden:true}, .... etc....],
};
This is just an example data structure. It could be organized in anyway that makes it easier for you to code.
Now your dropdown script is written to use the data structure instead of being hard code. Makes it easier to maintain.
Use the Acrobat JavaScript Reference early and often

