Skip to main content
Participant
February 23, 2018
Question

Combobox to populate text box problem when adding 2nd Combo box to document

  • February 23, 2018
  • 1 reply
  • 255 views

I have been following this tutorial (https://acrobatusers.com/tutorials/change_another_field ) on how to make combo boxes populate a field and have had great success. My trouble is when I add a second Combo Box the first one won't work when I delete the second one it does work. I believe there must be a problem with the code which I don't quite understand. My code is as follows:


First document level javascript:

// Place all prepopulation data into a single data structure

var ClinicData = { 'Highfields' :{Address1: "Shop 4A / 66 Highfields Rd",

                              Address2: "Highfields QLD 4352",

                              Number: "1300 792 634" },

                 'Laidley' :{ Address1: "Shop 6 / 132 Patrick St",

                              Address2: "Laidley QLD 4341",

                              Number: "1300 792 634" },

                 'Birkdale' :{ Address1: "9B / 120-124 Birkdale Rd ",

                              Address2: "Birkdale QLD 4159",

                              Number: "1300 792 634" },

                 'NewClinic' :{ Address1: "Address line 1",

                              Address2: "Address line 2",

                              Number: "Phone Number" }};

function SetFieldValues(cClinicName)

{

  this.getField("ClinicAddress1").value = ClinicData[cClinicName].Address1;

  this.getField("ClinicAddress2").value = ClinicData[cClinicName].Address2;

  this.getField("ClinicNum").value = ClinicData[cClinicName].Number;

}

Second document level java script:

// Place all prepopulation data into a single data structure

var ClinicianData = { 'Wesley Ong' :{ Email: "wes@fidelityhearingcentre.com.au"},

                          

                 'Trinnette Walmsley' :{ Email: "trinette@fidelityhearingcentre.com.au"},

                             

                 'James Sleeth' :{ Email: "james@fidelityhearingcentre.com.au"},

               

                 NewClinician:{ Email: "New@fidelityhearingcentre.com"}};

                             

function SetFieldValues(cClinicianName)

{

this.getField("ClinicianEmail").value = ClinicianData[cClinicianName].Email;}

If anyone could help I would greatly appreciate this.

All the best,

James

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
March 2, 2018

You can't use the same function name "SetFieldValues" for two different functions.