How to Make URLs Clickable in a PDF Form Field
Question details
The user needs a method to make URLs that end-users type or paste into a PDF form text field automatically clickable, allowing them to open in a web browser.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where respondents need to input website URLs, and the form creator wants those URLs to function as clickable hyperlinks.
- Observed behavior
- By default, URLs pasted into PDF form text fields are treated as plain text and do not automatically become clickable hyperlinks.
Ensure you are using a PDF editor that supports advanced form creation and JavaScript execution, as basic PDF viewers cannot configure interactive field actions.
Configure the Text Field with JavaScript to Open URLs
Use a simple JavaScript action triggered by a mouse click to automatically read the URL entered in the form field and open it in the user's default web browser.
To achieve this, you need to add an action to the form field properties. When the user clicks the text field containing the URL, a background script will capture the entered text and launch it as a web link.
Open your PDF document and switch to 'Prepare Form' or 'Form Edit' mode to view all form fields.
Right-click the text field where users will enter the URL and select 'Properties' from the context menu.
In the Properties dialog box, go to the 'Actions' tab.
Under 'Select Trigger', choose 'Mouse Up'. This ensures the action executes when a user clicks and releases the mouse button on the text field.
Under 'Select Action', choose 'Run a JavaScript' and click the 'Add' button.
In the JavaScript Editor, enter the following code: if (!/^\s*$/.test(event.target.value)) { app.launchURL(event.target.value); } then click 'OK' and close the properties window.

Use Comment Text Boxes for Manual Links
If you do not need a formal, interactive form field, you can use comment text boxes as an alternative where users can manually copy and paste URLs.
Create Interactive PDF Forms with WPS Office
WPS Office provides a comprehensive suite of PDF tools, allowing you to easily design interactive forms, insert text fields, and manage document properties with ease.
- 1. Open WPS PDF: Launch WPS Office and open your PDF document using the WPS PDF tool.
- 2. Access Form Tools: Navigate to the Form tab to access tools for adding text fields, checkboxes, and buttons.
- 3. Insert Text Field: Click on 'Text Field' and drag on the page to place it, then double-click to access its properties.
- 4. Save and Distribute: Save your interactive PDF form and share it with your users for data collection.

Frequently Asked Questions
Why isn't the JavaScript link working in my web browser's PDF viewer?
Many built-in web browser PDF viewers (like those in Chrome or Edge) disable or limit JavaScript for security reasons. Users should open the PDF form in a dedicated desktop application, such as Adobe Acrobat or WPS Office, to ensure interactive scripts run correctly.
Can I make a user-entered URL clickable without using JavaScript?
In standard PDF forms, text fields are designed to capture plain text only. While static text added by the creator can be made clickable using the Link tool, dynamically transforming user-entered text into a hyperlink requires JavaScript.
What does 'Mouse Up' mean in PDF form triggers?
'Mouse Up' refers to the exact moment the user releases the mouse button after clicking. It is the standard and most reliable trigger for activating buttons and interactive scripts in PDF forms, as it gives the user a chance to drag their mouse away if they clicked by mistake.




