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

Fill a text field from dtaa in a drop down menu

New Here ,
Feb 20, 2025 Feb 20, 2025

I have 3 fields I'd like to fill as text fields based on a drop down menu selection.

 

My dropdown field is "Client Name"

The text fields I'd like to fill based on my drop down choice are:

Text field 1:  Account number

Text Field 2: Purchase Order number

Text Field 3:  Name of client from the drop down menu

 

Thanks in advance to anyone who can help me.

531
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Feb 20, 2025 Feb 20, 2025

You can use this script in the dropdown field as a Validate script:

var cList = {
 "Client Name1": { accountNum: 123, orderNum: 111 },
 "Client Name2": { accountNum: 234, orderNum: 222 },
 "Client Name3": { accountNum: 345, orderNum: 333 }
};

var f1 = this.getField("Text1");
var f2 = this.getField("Text2");
var f3 = this.getField("Text3");
var selectedName = event.value;

if (cList[selectedName]) {
 f1.value = selectedName;
 f2.value = cList[selectedName].accountNum;
 f3.value = cList[selectedName].orderNum;} 
else {
 f1.value = "";
 f2.value = "";
 f3.value = "";}

Replace "Text1", "Text2", and "Text3" with the actual field names in your form.

Replace "Client Name1", "Client Name2", etc., with the names that appear in your dropdown field.

Update the accountNum and orderNum values with the correct numbers for each client.

If you add more clients, simply add a new line inside cList, using a comma after each entry (except the last one).

 

View solution in original post

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 ,
Feb 20, 2025 Feb 20, 2025

Put quotes around all the values.

View solution in original post

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 ,
Feb 20, 2025 Feb 20, 2025

which app?  acrobat pro?

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 ,
Feb 20, 2025 Feb 20, 2025

you have other posts in the acrobat forum, so i'm not sure why you posted in a forum that for discussions about adobe's forums.

 

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
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 ,
Feb 20, 2025 Feb 20, 2025

As the custom validation event of the drop-down field enter code like this:

 

if (event.value=="John Smith") {
	this.getField("Text field 1").value = "12345";
	this.getField("Text field 2").value = "99999";
	this.getField("Text field 3").value = event.value;
} else if (event.value=="Jane Doe") {{
	this.getField("Text field 1").value = "23456";
	this.getField("Text field 2").value = "88888";
	this.getField("Text field 3").value = event.value;
}
//etc.
else {
	this.getField("Text field 1").value = "";
	this.getField("Text field 2").value = "";
	this.getField("Text field 3").value = "";
}

Adjust the field names and values as needed, of course.

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 ,
Feb 20, 2025 Feb 20, 2025

You can use this script in the dropdown field as a Validate script:

var cList = {
 "Client Name1": { accountNum: 123, orderNum: 111 },
 "Client Name2": { accountNum: 234, orderNum: 222 },
 "Client Name3": { accountNum: 345, orderNum: 333 }
};

var f1 = this.getField("Text1");
var f2 = this.getField("Text2");
var f3 = this.getField("Text3");
var selectedName = event.value;

if (cList[selectedName]) {
 f1.value = selectedName;
 f2.value = cList[selectedName].accountNum;
 f3.value = cList[selectedName].orderNum;} 
else {
 f1.value = "";
 f2.value = "";
 f3.value = "";}

Replace "Text1", "Text2", and "Text3" with the actual field names in your form.

Replace "Client Name1", "Client Name2", etc., with the names that appear in your dropdown field.

Update the accountNum and orderNum values with the correct numbers for each client.

If you add more clients, simply add a new line inside cList, using a comma after each entry (except the last one).

 

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
New Here ,
Feb 20, 2025 Feb 20, 2025

Ms. Nurani,

 

Once again, you've proven to be very helpful.  Thank you for this.

 

Only fly in the ointment is my account numbers are alphanumeric.  Your script works perfectly for numeric entries, but I get a syntax error when attempting to make the account number alphanumeric:

 

SyntaxError: missing } after property list 2: at line 3 

 

Example of an account number:  ATPL 12345

 

Thank you so much for your help.

 

Sincerely,

 

Mark

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 ,
Feb 20, 2025 Feb 20, 2025

Put quotes around all the values.

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
New Here ,
Feb 20, 2025 Feb 20, 2025
LATEST

Hi try67,

 

Thank you so much.  Worked perfectly.  Doing exactly what I want it to do.

 

Thank you again.  Take care and stay safe.

 

Mark

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