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

Show and Hide fields in pdf Form

New Here ,
May 26, 2025 May 26, 2025

Hello

 

I would like to be able to just show the next fields after clicking to fill in the top row.Captura de ecrã 2025-05-26, às 20.07.23.png

 

Ex: When clicking on the first cell, the fields appear: "column.B.1", "column.C.1", "column.D.1", "column.A.2" (first field of the 2nd row);

 

I would like to make it so that the code used is always the same in column.A.

Something like this, when clicking on column.A.1 of ("column.A.__"+1), it showed the cell column.A.2.

Is it possible with array? And how to do it?

And it will be possible to do something like "column.[B-D].1", is it possible to do this?

 

Hugo Vieira da Silva

 

TOPICS
PDF , PDF forms
392
Translate
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 ,
May 26, 2025 May 26, 2025

What do you mean by show?  The fields are already invisible unless highlighting is turned on. 

Do you mean that you don't want the user to be able to enter data in the other fields in the row, unless text is entered into the first column of the row? 

If so, then a better stategy would be to use a validation script on the first field in each row to test the field for an empty string. 

And yes, the same script can be used for all rows if it is well written. 

 

Here's an article on showing and hiding fields. The same technique would also work for enabling/disabling the fields using the readonly property.  

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

 

 

 

 

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

Translate
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
New Here ,
May 27, 2025 May 27, 2025

Good morning,

 

I've been looking at this page and I haven't been able to do anything. And believe me, I've tried without asking and reading everything that appeared on the web, but I can't.

 

Can you teach me?

 

Hugo Vieira da Silva

Translate
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 ,
May 27, 2025 May 27, 2025

In order to help you, we need to understand your requirements. Please tell us what you hope to achieve. What is the high level behavior on the form? What to you want the users to experience?  

 

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

Translate
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
New Here ,
May 28, 2025 May 28, 2025

Hi, what I would like to know is the following:

1. I want only the next row of the table to appear available for filling, after starting to fill in the previous row;

2. If each cell of the table is identified with (e.g. "cell.A.1" where A is the column and 1 is the row);

3. Is it possible to name the cells with code? How?;

4. Is it possible to just make a copy of the row and keep the code? How?

I really appreciate your help

 

Hugo Vieira da Silva

Communication and Graphic Designer
Division of Local Commerce, Economy and Tourism
City Council of Loulé

Translate
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 ,
May 28, 2025 May 28, 2025
LATEST

It is possible with a script on a form to create new fields. However, this only work if the form is open in Acrobat Pro or Reader. It does not work for any other PDF viewer. 

 

I think the best solution is to make all the fields "readonly" except for the first row. Then use a validation or calculation script on the first field of each row to determine when the next row should be enabled. 

 

The first issue for you to figure out is what are the criteria for determining when a row is considered filled.  And since the form is restricting the user until the row is filled, it would be helpful for the user to have an indication, such as a status message in red, that the row is not yet complete.  

 

 

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

Translate
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 ,
May 27, 2025 May 27, 2025

If you just want to show fields, you can use the built in action to show/hide fields.

Or if you want a script, you can use something like this as 'On Focus' action of field "column.A.1":

this.getField("column.B.1").display = display.visible;
this.getField("column.C.1").display = display.visible;
this.getField("column.D.1").display = display.visible;
this.getField("column.A.2").display = display.visible;

You can use another script as 'On Blur' action if field is left empty to hide fields.

For another row use script in A2 just change field names.
If you need something else pleace try to describe what exactly you looking for.

 

Translate
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