Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do you make a drop down menu item prompt a user to fill out specific sections of your form?

New Here ,
Mar 17, 2021 Mar 17, 2021

I am making a universal form for multiple scenarios and looking to have the user prompted to only fill out specific sections of the form based on which drop down item they choose. Is there a way to do this? Maybe they highlight after selecting the desired menu item? Thanks!

TOPICS
Edit and convert PDFs , How to , JavaScript , Standards and accessibility
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021

You can set fields as read-only based on the selection in the drop-down.

Here's a simple example, which you can use as the custom Validation script of the drop-down field:

 

// Set fields as read-only or as editable based on the selection
this.getField("Text1").readonly = (event.value=="Option 1");
this.getField("Text2").readonly = (event.value=="Option 1");
this.getField("Text3").readonly = (event.value=="Option 1");
this.getField("Text4").readonly = (event.value=="Option 2");
this.getField("Text5").readonly = (event.value=="Option 2");
this.getField("Text6").readonly = (event.value=="Option 3");

// Reset the disabled fields
if (event.value!="Option 1") this.resetForm(["Text1", "Text2", "Text3"]);
if (event.value!="Option 2") this.resetForm(["Text4", "Text5"]);
if (event.value!="Option 3") this.resetForm(["Text6"]);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021

You can also hide and show fields,

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021
LATEST

++ Adding to the discussion,

 

To prompt a user when an particular item  is selected from a dropdown menu list, you can use a custom keystroke script to trigger an alert message when that particular item is selected form the list.

 

For example, I created a dropdown menu with three items, and I named them "item1", "item2", and "item3".

 

You can use a cutom keystroke script like shown below to show a message alert to the user when "item1" is selected:

 

if (event.willCommit) {

 

if (event.value == "test1")

 

app.alert("Please select Option 1 of block B in Page", 3);

 

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines