Skip to main content
Participant
June 25, 2023
Question

Auto populate multiple fields from Drop Down Selection

  • June 25, 2023
  • 2 replies
  • 1022 views

Good Morning, 

 

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

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.

This topic has been closed for replies.

2 replies

Bernd Alheit
Community Expert
Community Expert
June 26, 2023

Use the script at validation of the dropdown.

Participant
June 26, 2023

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?

Bernd Alheit
Community Expert
Community Expert
June 26, 2023

Where does you use the script?

Participant
June 26, 2023

I placed it in 'Document Javascript' in PDF