These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Combobox invalid label

ternef4339
Registered: Oct 23 2011
Posts: 4
Answered

I need some help. Working with Tom Parker Toot changing another fields with a ComboBox and get an error invalid label (3:på row4)
 
I have tried to solve this myself without success.
  

 // Place all pre-population data into a single data structure var PersonalData = 
{ A: { n
Namn: "xxxx xxxxxxxxx" , 
Email: "<span class="spamspan"><span class="u">xxxx</span> [at] <span class="d">hotmail [dot] com</span></span>" ,
Bolag: "xxx" },
B:{ 
Namn: "xxxx xxxxxxx", 
Email: "<span class="spamspan"><span class="u">x</span> [at] <span class="d">hotmail [dot] com</span></span>", 
Bolag: "xxx" }}; 
 
&nbsp;<br />
function SetFieldValues(cPersonalName) { // Populate fields with values from the Personal Data Object
 this.getField("PersonalNamn").value = PersonalData[cPersonalName].namn; 
this.getField("PersonalEmail").value = PersonalData[cPersonalName].email; 
this.getField("PersonalBolag").value = PersonalData[cPersonalName].bolag; } 

 
/Annelie

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You have to escape double-quotes inside of a string.
Also, where is the definition of PersonalData?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

ternef4339
Registered: Oct 23 2011
Posts: 4
Thanks for your reply. I have just solved the problem with "invalid label", but I still have problems with the combo box does not change my field.

Now I get the following message when I look at Advanced - Document Processing-JavaScript debugging:

Inbyggda funktioner i Acrobat Escript version 9.0
Inbyggda funktioner för anteckningar/onlinekommentarer i Acrobat version 9.0
Inbyggda guidefunktioner för anteckningar/onlinekommentarer, Acrobat version 9.0
Acrobat SOAP 9.0

PersonalData[cPersonalName] has no properties
3:Field:Keystroke
PersonalData[cPersonalName] has no properties
3:Field:Keystroke

--------------------------------------------------------------------------------------------------------------
function SetFieldValues(cPersonalName) {
//Populate fields with values from the Personal Data Object
this.getField("PersonalNamn").value = PersonalData[cPersonalName].namn;
this.getField("PersonalEmail").value = PersonalData[cPersonalName].email;
this.getField("PersonalOrganisation").value = PersonalData[cPersonalName].organisation;
}

var PersonalData = { Styrelseledamot1:{
namn: "xxxx xxxxx",
email: "xxxx [at] hotmail [dot] com",
organisation: "xxxxxxx" },
Styrelseledamot2:{
namn: "xxxx xxxx",
email: "xxxx@xxxxxx",
organisation: "xxxxxxxx" }};

/Annelie







gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
The value for variable 'cPersonalNme' still has not been declared as a variable and has not value within the script.

What is the code you are using for the custom keystroke for the combo box?

I would suspect it is:

// pass the selected value to the SetFieldValues funtion.
SetFieldValues(event.value);

When you have the value of the combo box being set immediately.

George Kaiser

ternef4339
Registered: Oct 23 2011
Posts: 4
In the combo box I have this script.

if( event.willCommit )
{
if(event.value == "")
this.resetForm(["PersonalNamn","PersonalEmail","PersonalOrganisation"]);
else
SetFieldValues(event.value);
}

/Annelie
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
1. The value of a combo-box can't be an empty string, maybe a single space.
2. I think that in your associative array you need to name the objects (Styrelseledamot1) as strings, by placing double-quotes around them.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

ternef4339
Registered: Oct 23 2011
Posts: 4
try67!
Thank you so much for the tip about the double-qoutes, the ComboBox changing my fields. :))

/Annelie