PDF Editing Issues

How to Create Expandable and Collapsible Sections in a PDF Form

Adam DavisAdam Davis Nov 5, 2026 871 views

Question details

The user wants to design an interactive PDF form that shows or hides specific sections dynamically based on user interactions, such as checking a box or selecting a radio button.

How to Create Expandable and Collapsible Sections in a PDF Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Designing an interactive PDF form with conditional logic to keep the layout clean and only display relevant fields to the user.
Observed behavior
Form sections need to dynamically expand or collapse, but implementing this functionality relies on layers or JavaScript, which may behave inconsistently across different third-party PDF viewers.
Before you start

Ensure you have an advanced PDF editor like Adobe Acrobat Pro installed, as basic PDF readers do not have the capability to author document JavaScript or configure form field visibility.

Solution 1Recommended

Use Acrobat JavaScript to Control Field Visibility

The most common and reliable method to create collapsible sections in standard PDFs is by using JavaScript attached to checkboxes or radio buttons to toggle the visibility of specific form fields.

By assigning JavaScript actions to your form controls, you can instruct the PDF viewer to hide or display specific text fields, dropdowns, or entire sections whenever a user interacts with the trigger element.

1
Add form controls

Insert a checkbox or radio button that users will click to trigger the expandable section.

2
Create the collapsible section

Add the text fields, dropdowns, or other elements that make up the section you want to hide or show, and assign them consistent names (e.g., 'Section1_Field1').

3
Access field properties

Right-click the trigger checkbox or radio button, select 'Properties', and navigate to the 'Actions' tab.

4
Add a JavaScript trigger

Select 'Run a JavaScript' from the 'Select Action' dropdown menu and click 'Add'.

5
Enter the visibility code

Input the JavaScript code to toggle visibility based on the checkbox state. For example: if (event.target.value !== 'Off') { this.getField('TargetField').display = display.visible; } else { this.getField('TargetField').display = display.hidden; }

Use Acrobat JavaScript to Control Field Visibility
Viewer Compatibility Limitation: Always test your interactive form in Adobe Acrobat or Reader. Many third-party PDF viewers or browser plugins do not support document JavaScript and may permanently display all fields.

Easily Fill and Manage PDF Forms with WPS Office

While creating complex JavaScript-based expandable sections requires specialized authoring tools, WPS Office provides a powerful and lightweight PDF Editor to flawlessly view, fill, and manage interactive PDF forms.

  1. 1. Open your PDF form: Launch WPS Office and open your interactive PDF document using the built-in PDF reader.
  2. 2. Interact with fields: Click on checkboxes, radio buttons, and text fields to fill out the form sections smoothly.
  3. 3. Edit PDF content: Switch to the 'Edit' tab to easily modify static text, adjust images, or add custom shapes to your document.
  4. 4. Save and share securely: Once your form is filled, save your document or export it to seamlessly share the completed form with others.
Smoothly fill out and sign interactive PDF forms with high compatibility.Lightweight architecture ensures fast loading and processing on any device.Comprehensive PDF toolkit for editing text, images, and managing pages.Cross-platform support for Windows, Mac, Linux, iOS, and Android.
microsoft office alternative - wps office

Frequently Asked Questions

Why are my expandable PDF sections showing up entirely visible on mobile devices?

Many mobile PDF readers and built-in browser viewers do not support advanced document JavaScript or PDF layer toggling. Because the scripts cannot run, these basic viewers default to displaying all form fields at once. Instruct users to open the form in a fully supported application like Adobe Acrobat Reader or a robust alternative.

Can I create expandable sections in a PDF without using JavaScript?

Yes, you can author the document using layered designs in tools like Adobe InDesign or Illustrator, and export them as a layered PDF. However, you will still need to configure buttons in Acrobat to toggle the visibility of those layers, which may also face compatibility issues in basic viewers.

Will printing the PDF show the collapsed sections?

It depends on how the field properties are configured. In Acrobat, you can set fields to 'Visible but doesn't print' or fully 'Hidden'. If properly configured via JavaScript to be 'hidden', the collapsed sections will not appear on the printed physical copy.

Is Adobe LiveCycle Designer still available for creating dynamic forms?

Adobe LiveCycle Designer is now integrated into Adobe Experience Manager (AEM) Forms, which is an enterprise-level solution used to create highly dynamic XFA forms. For standard desktop users, Acrobat Pro's JavaScript and layers remain the primary workarounds for achieving dynamic behavior in standard AcroForms.