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

Auto populate multiple fields from Drop Down Selection

Community Beginner ,
Jun 25, 2023 Jun 25, 2023

Good Morning, 

 

I am hoping for assistance with the below scenario. Upon selection of name the 3 fields autopopulate:

louise30713911u9yf_0-1687734738575.png

The javascript I entered isn't working. I also have not entered a reset form code, is this necessary? Below is what I have attempted:

 

var PoistionTitle = "";
var PositionNo = "";
var ApproverID = "";

if ( event.value == "Hopkins, Rachael"){
PositionTitle = "PCS";
PositionNo = "123456";
AproverID = "1111111"

} else if ( event.value == "Perry, Mark"){
PositionTitle = "PCS";
PositionNo = "789123";
AproverID = "222222"
}
else if ( event.value == "Mitchell, Ellis"){
PositionTitle = "PCO";
PositionNo = "999999";
AproverID = "333333"
}

{
this.getField("PositionTitle").value = PositionTitle;
this.getField("PositionNo").value = PositionNo;
this.getField("ApproverID").value = ApproverID;
}

Any guidance would be greatly appreciated.

TOPICS
Edit and convert PDFs , JavaScript , PDF forms
1.1K
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 ,
Jun 25, 2023 Jun 25, 2023

Where does you use the script?

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 Beginner ,
Jun 25, 2023 Jun 25, 2023

I placed it in 'Document Javascript' in PDF

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 ,
Jun 25, 2023 Jun 25, 2023

Use the script at validation of the dropdown.

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 Beginner ,
Jun 26, 2023 Jun 26, 2023
LATEST

Thank you. It is now auto populating the position title and position no box but not the approver ID. Have I missed something with the code?

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