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

Is there a way to make a drop-down list to open or lock a text field.

Community Beginner ,
Oct 16, 2023 Oct 16, 2023

Copy link to clipboard

Copied

I'm looking to make a drop down list to based upon a selection to open or close um a text field position so for example if I want field text 1 and 2 to open when B is selected but close off when C is selected but opens up number 4 how would I do that, thank you.

TOPICS
Edit and convert PDFs , How to , Modern Acrobat , PDF

Views

410

Translate

Translate

Report

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 ,
Oct 16, 2023 Oct 16, 2023

Copy link to clipboard

Copied

Sure. Here's a sample code (to be used as the custom Validation script of the drop-down field):

 

if (event.value=="B") {
	this.getField("Text1").readonly = false;
	this.getField("Text2").readonly = false;
} else {
	this.getField("Text1").readonly = true;
	this.getField("Text2").readonly = true;
	this.resetForm(["Text1", "Text2"]);
}

Votes

Translate

Translate

Report

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 Beginner ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

Does this work within other scripts like. 

var dropdownValue = this.getField("Age").value;

switch (dropdownValue) {
case "Child (0-15)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = "-10"
this.getField("INS4").value = "-10"
this.getField("CHA4").value = "10"
this.getField("LUCK4").value = "10"
this.getField("Age1").value = "X"
this.getField("Age2").value = "X"
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;

case "Youth (16-29)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = "-5"
this.getField("INS4").value = "-5"
this.getField("CHA4").value = "5"
this.getField("LUCK4").value = "5"
this.getField("Age2").value = "X"
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;

case "Middle (30-45)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = ""
this.getField("INS4").value = ""
this.getField("CHA4").value = ""
this.getField("LUCK4").value = ""
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;

case "Mature (46-59)":
this.getField("STR4").value = "-5"
this.getField("FOR4").value = ""
this.getField("INT4").value = "5"
this.getField("INS4").value = "5"
this.getField("CHA4").value = "-5"
this.getField("LUCK4").value = ""
this.getField("Age4").value = "X"
break;

case "Geriatric (60+)":
this.getField("STR4").value = "-10"
this.getField("FOR4").value = "-10"
this.getField("INT4").value = "10"
this.getField("INS4").value = "10"
this.getField("CHA4").value = "-10"
this.getField("LUCK4").value = "10"
break;

case "-Select-":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = ""
this.getField("INS4").value = ""
this.getField("CHA4").value = ""
this.getField("LUCK4").value = ""
this.getField("Age1").value = "N/A"
this.getField("Age2").value = "N/A"
this.getField("Age3").value = "N/A"
this.getField("Age4").value = "N/A"
break;

}

Votes

Translate

Translate

Report

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 Beginner ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

LATEST

i want the age#s parts to be the ones that close or open

Votes

Translate

Translate

Report

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