Show Optional PDF Pages with a Radio Button in Adobe Acrobat
Question details
Add an optional PDF page when a user selects a radio button.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form includes optional certification or information pages that should appear only when needed.
- Observed behavior
- Selecting a radio button should add the relevant optional page to the PDF.
Open the PDF in Adobe Acrobat and prepare the optional page and radio button. Make sure JavaScript is enabled and note the exact name you assign to the page template.
Spawn a Page Template with a Radio Button Action
Use an Acrobat page template and a Mouse Up JavaScript action to add an optional page when the radio button is selected.
The action creates a page from a template; it does not reveal an existing hidden page. The example appends the new page to the end of the document.
Open Organize Pages and use the Page Templates option to create a template from the optional page. Give it a distinctive name, then hide the template if the page should not appear initially.
Open Prepare a Form, select the radio button, and open its Properties dialog. Go to the Actions tab.
Select Mouse Up as the trigger and Run a JavaScript as the action, then click Add. Enter: var template = getTemplate("Template Name"); if (event.target.value != "Off") { template.spawn({nPage: numPages, bRename: false, bOverlay: false}); }
Replace Template Name in the script with the exact template name, save the PDF, and use Preview or reopen the file to select the radio button. Check that the optional page appears at the end.

Work with PDF and Office Documents in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and Office files. It can help you migrate everyday document work, but it does not replace Acrobat's page-template JavaScript workflow.

Frequently Asked Questions
Where do I add the radio button script in Acrobat?
Open Prepare a Form, open the radio button's Properties, and select Actions. Choose Mouse Up and Run a JavaScript, then click Add.
Does the script reveal the original hidden page?
No. The script spawns a new page from the named template and appends it to the document.
Why does selecting the radio button add multiple pages?
The example spawns a page each time the action runs while the value is not Off. Preventing duplicates requires additional logic to check whether the page has already been added.
Will the form work in every PDF viewer?
Not necessarily. PDF viewers differ in their support for Acrobat JavaScript and template spawning. Test the saved form in the viewer your recipients will use.




