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

New Here ,
Feb 22, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

83

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

New Here ,
Feb 22, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

84

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 22, 2018 0
Adobe Community Professional ,
Mar 02, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2018 0