How to Remove a Required Field Border After Text is Entered in PDF Forms
Question details
The user needs to make a conditionally required Acrobat form field stop appearing incomplete (displaying a required border) immediately after text is entered.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating or editing a fillable PDF form where specific text fields are marked as required but should visually update once filled.
- Observed behavior
- The form field retains its 'required' visual indicator (such as a red border) even after the user has typed text into it.
Ensure you have access to a professional PDF editor that supports JavaScript for forms, such as Adobe Acrobat Pro, and that you have form-editing permissions for the document.
Use a Custom Validation Script to Toggle the Required Status
Apply a short JavaScript code to the field's validation settings to automatically remove the required status (and its border) once text is entered.
When a field is set as required in a PDF form, it typically displays a distinct colored border to alert the user. By using a custom validation script, you can dynamically change the field from required to optional the moment a user inputs text, effectively removing the border.
Open your PDF form in your PDF editor (like Adobe Acrobat) and enter 'Prepare Form' mode from the Tools menu.
Right-click the specific required text field you want to modify and select 'Properties' from the context menu.
Navigate to the 'Validate' tab in the Properties dialog box and select the 'Run custom validation script' option.
Click the 'Edit' button and paste the following code: event.target.required = (event.value.length == 0); then click 'OK'.
Close the Properties dialog and exit form editing mode. Type text into the field to verify that the required border disappears automatically.

Create and Manage Fillable PDF Forms with WPS Office
WPS Office provides a comprehensive built-in PDF editor that allows you to easily create, edit, and manage fillable PDF forms. You can seamlessly add text fields, checkboxes, and modify form properties with a highly intuitive user interface.
- 1. Open Your PDF in WPS Office: Launch WPS Office and open your existing PDF document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all available form creation and editing tools.
- 3. Edit Field Properties: Double-click any form field to open its properties panel, where you can quickly adjust its appearance, formatting, and set it as required or optional.

Frequently Asked Questions
Why does my PDF form field stay red after typing?
By default, a field marked as 'Required' in form properties retains its required formatting (like a red border) until the form is submitted or validated. Using a custom validation script allows the field to dynamically update its appearance as soon as it contains text.
Can I apply this validation script to multiple fields at once?
Yes, you can select multiple fields in form editing mode, right-click to access their shared Properties, and paste the JavaScript code into the Validate tab. The script uses 'event.target', which will dynamically apply to whichever field triggers it without needing to change field names.
Does WPS Office support creating required form fields?
Yes, WPS Office's PDF editor features comprehensive form tools. You can create fillable forms, insert text fields, checkboxes, or dropdowns, and set specific fields as 'Required' through the field properties menu.




