How to Create Expandable and Collapsible Sections in a PDF Form
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.

- 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.
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.
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.
Insert a checkbox or radio button that users will click to trigger the expandable 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').
Right-click the trigger checkbox or radio button, select 'Properties', and navigate to the 'Actions' tab.
Select 'Run a JavaScript' from the 'Select Action' dropdown menu and click 'Add'.
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; }

Design Separate Layers in InDesign or Illustrator
If you are authoring the document from scratch, you can use layers to represent different form versions and toggle their visibility.
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. Open your PDF form: Launch WPS Office and open your interactive PDF document using the built-in PDF reader.
- 2. Interact with fields: Click on checkboxes, radio buttons, and text fields to fill out the form sections smoothly.
- 3. Edit PDF content: Switch to the 'Edit' tab to easily modify static text, adjust images, or add custom shapes to your document.
- 4. Save and share securely: Once your form is filled, save your document or export it to seamlessly share the completed form with others.

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.




