Copy link to clipboard
Copied
This is my first time attempting such a form and I have used the Adobe tutorial located at: https://acrobatusers.com/tutorials/change_another_field. I have managed to replicate the tutorial but not my own document yet.
What I am wanting to do is have my Office Locations (which is a drop down menu) once selected, automatically fill the GLCode field. I have completed all the steps until step 12 - there with the following syntax, I get an error:
{
var DeptData = {Altona Public Health Office:{ GLCode: "880-1-715521211-46060"}, Boundary Trails Health Centre:{GLCode: "XXX-1-715521211-46060"},Carman Public Health Office:{ GLCode: "XXX-1-715521211-46060"},Elie Public Health Office:{ GLCode: "XXX-1-715521211-46060"},Gladstone Public Health Office: {GLCode: "XXX-1-715521211-46060"},La Broquerie Public Health Office:{ GLCode: "XXX-1-715521211-46060"},La Salle Public Health Office: { GLCode: "XXX-1-715521211-46060"},Lorette Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, MacGregor Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Montcalm Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Morris Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Niverville Public Health Office: {GLCode: "XXX-1-715521211-46060"}, Notre Dame Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Pilot Mound Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Portage Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Rosenort Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Somerset Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, St. Claude Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, St. Pierre Public Health Office: {GLCode: "XXX-1-715521211-46060"}, Ste. Agathe Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Ste. Anne Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Steinbach Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Swan Lake Public Health Office:{ GLCode: "XXX-1-715521211-46060"}, Vita Public Health Office:{ GLCode: "XXX-1-715521211-46060"}};
function SetFieldValues(cOfficeLocation)
{
// Populate fields with values from the Department Data Object
this.getField("GLCode").value = DeptData[cOfficeLocation].GLCode
}
The error I get is : SyntaxError: Missing : after property ID 3: at line 4. It highlights the function SetFieldValues(cOfficeLocation) line.
Any help here would be greatly appreciated.
Copy link to clipboard
Copied
Figured it out. Here is the code I used.
{
var
DeptData =
{"Altona
Public Health Office":{ GLCode: "880-1-715521211-46060"},
"Boundary
Trails Health Centre":{GLCode: "XXX-1-715521211-46060"},
"Carman
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Elie
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Gladstone Public Health Office": {GLCode: "XXX-1-715521211-46060"},
"La
Broquerie Public Health Office":{ GLCode:
"XXX-1-715521211-46060"},
"La
Salle Public Health Office": { GLCode: "XXX-1-715521211-46060"},
"Lorette
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"MacGregor
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Montcalm
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Morris
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Niverville
Public Health Office": {GLCode: "XXX-1-715521211-46060"},
"Notre
Dame Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Pilot
Mound Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Portage
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Rosenort
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Somerset
Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"St. Claude Public Health Office":{
GLCode: "XXX-1-715521211-46060"},
"St.
Pierre Public Health Office": {GLCode: "XXX-1-715521211-46060"},
"Ste. Agathe Public Health Office":{
GLCode: "XXX-1-715521211-46060"},
"Ste.
Anne Public Health Office":{ GLCode: "XXX-1-715521211-46060"},
"Steinbach Public Health Office":{
GLCode: "XXX-1-715521211-46060"},
"Swan Lake Public Health Office":{
GLCode: "XXX-1-715521211-46060"},
"Vita
Public Health Office":{ GLCode: "XXX-1-715521211-46060"}};
function
SetFieldValues(cOfficeLocation)
{
// Populate fields with values from the
Department Data Object
this.getField("GLCode").value =
DeptData[cOfficeLocation].GLCode
}
}