• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
0

Multiple Text field layer

New Here ,
Feb 26, 2023 Feb 26, 2023

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. 

TOPICS
PDF forms

Views

812

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 26, 2023 Feb 26, 2023

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?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2023 Feb 27, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

LATEST

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)

https://www.pdfscripting.com/public/programs/downloadsearch.cfm?searchtype=simple&searchmode=cat&key...

 

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.  

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines