Make PDF Form Fields Required Based on Rent or Own in Adobe Acrobat
Question details
The form author needs fields to become required when a user selects Rent or Own and wants to know which control and script to use.

- Product
- Adobe Acrobat Pro PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form records a Rent or Own choice and requires additional fields when either option is selected.
- Observed behavior
- The target fields should be marked required for form submission when Rent or Own is selected, and not required for other choices.
Open the PDF in Adobe Acrobat Pro and choose All tools > Prepare a form. Check the exact field names and ensure the PDF viewer used for testing supports Acrobat form JavaScript.
Use a radio-button choice and a Mouse Up script
Use this method when Rent and Own must be separate, mutually exclusive choices.
In All tools > Prepare a form, add radio buttons for Rent and Own. Give both buttons the same group name, such as HousingChoice, and set their export values to Rent and Own in their Properties.
In Prepare a form, open Properties for each field that should become required. Note its exact name and replace text1, text2, and text3 in the script with those names.
Open Properties > Actions for each radio button. Select Mouse Up as the trigger and Run a JavaScript as the action, click Add, and paste the same script for each button: (function () { var fields = ["text1", "text2", "text3"]; var choice = this.getField("HousingChoice").value; var required = choice === "Rent" || choice === "Own"; for (var i = 0; i < fields.length; i += 1) { this.getField(fields[i]).required = required; } })();
Use Preview in Prepare a form, select Rent and then Own, and test submission with the target fields empty and completed. If the group includes another choice, test that it clears the required setting.

Use a checkbox for one combined Rent or Own choice
Use a checkbox if the form only needs to record whether either condition applies, rather than distinguish Rent from Own.
Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and migrating everyday documents. Use Acrobat or another compatible PDF form editor for the conditional JavaScript described above.

Frequently Asked Questions
Should I use radio buttons or a checkbox for Rent and Own?
Use radio buttons with the same group name if users must choose Rent or Own. Use a single checkbox if the form only needs to know whether either condition applies.
Where do I put the conditional required-field script?
In Acrobat Pro, open All tools > Prepare a form, then open the choice control's Properties > Actions. Select Mouse Up and Run a JavaScript, and add the script. For a radio group, add it to each relevant button.
Why are empty required fields still saved or printed?
The required property is intended for form submission. It does not automatically block saving, closing, or printing the PDF.
Will the script work in every PDF viewer?
No. PDF viewers differ in their support for Acrobat form JavaScript and form submission. Test the completed form in the viewer your respondents will use.
How do I make more than three fields required?
Add their exact field names to the fields array in the script, separated by commas. The loop applies the same required setting to every listed field.




